fixed conflict
This commit is contained in:
@@ -5,7 +5,8 @@ class Api::BillController < Api::ApiController
|
||||
def create
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
if ShiftSale.current_shift
|
||||
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
#create Bill by Booking ID
|
||||
table = 0
|
||||
if (params[:booking_id])
|
||||
@@ -15,16 +16,18 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id(cashier_zone.cashier_terminal_id)
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier_by_terminal)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,6 +39,11 @@ class Api::BillController < Api::ApiController
|
||||
booking = Booking.find_by_sale_id(@sale_id)
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
@sale_data.shift_sale_id = shift_by_terminal.id
|
||||
@sale_data.save
|
||||
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
BillBroadcastJob.perform_later(table)
|
||||
|
||||
20
app/controllers/api/call_waiters_controller.rb
Normal file
20
app/controllers/api/call_waiters_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class Api::CallWaitersController < ActionController::API
|
||||
|
||||
#List all active customers by name
|
||||
def index
|
||||
@table_id = params[:dining_id]
|
||||
@time = params[:time]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
CallWaiterJob.perform_later(@table,@time)
|
||||
|
||||
# get printer info
|
||||
# @shop = Shop::ShopDetail
|
||||
# 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)
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,23 +1,47 @@
|
||||
class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
def check_in_time
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
booking = dining_facility.get_current_checkout_booking
|
||||
if !booking.nil?
|
||||
|
||||
DiningFacility.check_in_booking(params[:dining_id])
|
||||
|
||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
alert_time_min = 0
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'min'
|
||||
alert_time_min = (lookup_checkout_time[0][1]).to_i
|
||||
else
|
||||
alert_time_min = 15
|
||||
end
|
||||
end
|
||||
|
||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min }
|
||||
else
|
||||
render :json => { :status => false, :error_message => "No current booking!" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_in_process
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
if dining_facility.status == "available"
|
||||
dining_charge = DiningCharge.select('charge_type','charge_block')
|
||||
.where('dining_facility_id = ?',params[:dining_id])
|
||||
.first()
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !dining_charge.nil?
|
||||
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
||||
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
||||
# if dining_charge.charge_type == 'hr'
|
||||
checkout_at = checkout_at + hr.hour + min.minutes
|
||||
# else
|
||||
|
||||
# end
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
dining_facility.status = "occupied"
|
||||
@@ -28,12 +52,12 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
booking.save!
|
||||
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
else
|
||||
error_message = "#{dining_facility.type} is not available!"
|
||||
render :json => { :status => false, :error_message => error_message }
|
||||
@@ -58,7 +82,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
booking.checkout_at = checkout_at
|
||||
booking.save!
|
||||
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.strftime("%Y-%m-%d %H:%M") }
|
||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||
elsif !params[:booking_id].nil? && params[:time].nil?
|
||||
error_message = "time is required!"
|
||||
render :json => { :status => false, :error_message => error_message }
|
||||
|
||||
@@ -22,9 +22,10 @@ class ApplicationController < ActionController::Base
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) # request.subdomain.downcase
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
@@ -35,31 +36,32 @@ class ApplicationController < ActionController::Base
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
else
|
||||
# check for license file
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
end
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url)
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
|
||||
if (@license.detail_with_local_file() == true)
|
||||
puts "RUN SAY BYAR"
|
||||
flag = @license.detail_with_local_file()
|
||||
if (flag == 0)
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
return nil
|
||||
puts "RUN SAY BYAR"
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
# Export for Key
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(lookup)
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup, aes_key, aes_iv) == true)
|
||||
if (@license.detail_with_local_cache(lookup) == true)
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
@@ -109,9 +111,8 @@ class ApplicationController < ActionController::Base
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
return true
|
||||
else
|
||||
redirect_to install_path
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class BaseController < ActionController::Base
|
||||
layout "installation"
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
end
|
||||
|
||||
@@ -2,6 +2,8 @@ class BaseOrigamiController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "origami"
|
||||
|
||||
# before_action :checkin_process
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
@@ -13,4 +15,7 @@ class BaseOrigamiController < ActionController::Base
|
||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||
end
|
||||
|
||||
# def checkin_process
|
||||
# CheckinJob.set(wait: 1.minute).perform_later()
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -72,7 +72,9 @@ class Crm::CustomersController < BaseCrmController
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
puts @response.to_json
|
||||
|
||||
Rails.logger.debug "get membership transactions response"
|
||||
Rails.logger.debug @response.to_json
|
||||
# @response = ""
|
||||
#end customer amount
|
||||
|
||||
@@ -156,7 +158,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
rescue SocketError
|
||||
response = {"status" => false, "message" => "Can't open membership server "}
|
||||
end
|
||||
|
||||
Rails.logger.debug "--------------Create Member---------"
|
||||
Rails.logger.debug response.to_json
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
@@ -235,7 +238,7 @@ end
|
||||
id = @crm_customer.membership_id
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if id.nil? && !member_group_id.nil?
|
||||
if !id.present? && !member_group_id.nil?
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -277,10 +280,9 @@ end
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
puts "ssssssss"
|
||||
puts response.to_json
|
||||
customer = Customer.find(@crm_customer.customer_id)
|
||||
|
||||
Rails.logger.debug "--------Update Member response -------"
|
||||
Rails.logger.debug response.to_json
|
||||
if response["status"] == true
|
||||
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
@@ -337,10 +339,8 @@ end
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
puts "ssssssss"
|
||||
puts response.to_json
|
||||
|
||||
Rails.logger.debug "--------Update Member response -------"
|
||||
Rails.logger.debug response.to_json
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customer.customer_id)
|
||||
# Check membership id and bind to user
|
||||
|
||||
@@ -3,7 +3,8 @@ class HomeController < ApplicationController
|
||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
|
||||
def index
|
||||
@employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
@employees = Employee.all.order("name asc")
|
||||
@login_form = LoginForm.new()
|
||||
render "layouts/login_dashboard", layout: false
|
||||
end
|
||||
@@ -45,7 +46,7 @@ class HomeController < ApplicationController
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "supervisor"
|
||||
elsif @employee.role == "supervisor" || @employee.role == "waiter"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "account"
|
||||
@@ -72,7 +73,8 @@ class HomeController < ApplicationController
|
||||
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
@employee_sales = Sale.employee_sales(today).sum(:grand_total)
|
||||
@employee_sales = Sale.employee_sales(today)
|
||||
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||
|
||||
@total_sale = Sale.total_sale(today)
|
||||
@@ -86,10 +88,10 @@ class HomeController < ApplicationController
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||
pay = Sale.payment_sale('card', today)
|
||||
@sale_data.push({'card' => pay})
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(payment.payment_method, today)
|
||||
@sale_data.push({payment.payment_method => pay})
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(today)
|
||||
|
||||
@@ -1,42 +1,77 @@
|
||||
class InstallController < BaseController
|
||||
skip_before_action :verify_authenticity_token
|
||||
# before_action :check_license
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def create
|
||||
def activate
|
||||
flag = "<%= ENV['AES_IV'] %>"
|
||||
key_base = "<%= ENV['secret_key_base'] %>"
|
||||
|
||||
restaurant = params[:restaurant_name]
|
||||
license_key = params[:license_key]
|
||||
admin_user = params[:admin_user]
|
||||
admin_password = params[:admin_password]
|
||||
# admin_user = params[:admin_user]
|
||||
# admin_password = params[:admin_password]
|
||||
db_host = params[:db_host]
|
||||
db_schema = params[:db_schema]
|
||||
db_user = params[:db_user]
|
||||
db_password = params[:db_password]
|
||||
phrase = license_key
|
||||
|
||||
# Check Exists IV
|
||||
# if flag == "<%= ENV['AES_IV'] %>"
|
||||
# # Export for Key
|
||||
# aes = MyAesCrypt.new
|
||||
# aes_key, aes_iv = aes.export_key(phrase)
|
||||
# else
|
||||
# aes_key = ENV["AES_KEY"]
|
||||
# aes_iv = ENV["AES_IV"]
|
||||
# end
|
||||
|
||||
@license = License.new(ENV["SX_PROVISION_URL"])
|
||||
response = @license.license_activate(restaurant, license_key, db_host, db_schema, db_user, db_password)
|
||||
if response[:status]
|
||||
redirect_to root_url, notice: response["message"]
|
||||
else
|
||||
redirect_to activate_path, notice: response["message"]
|
||||
end
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
redirect_to root_url
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
# def lookup_domain
|
||||
# if request.subdomain.present? && request.subdomain != "www"
|
||||
# @license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||
# if (!@license.nil?)
|
||||
# # logger.info "Location - " + @license.name
|
||||
# ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
# else
|
||||
# # reconnect_default_db
|
||||
# logger.info 'License is nil'
|
||||
# # redirect_to root_url(:host => request.domain) + "store_error"
|
||||
# render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
#if (@license.detail == true)
|
||||
# def current_license(url, key)
|
||||
# @license = License.new(url, key)
|
||||
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
# ##creating md5 hash
|
||||
# md5_hostname = Digest::MD5.new
|
||||
# md5key = md5_hostname.update(request.host)
|
||||
# if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
# #if (@license.detail == true)
|
||||
|
||||
# return @license
|
||||
# else
|
||||
# return nil
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Inventory::InventoryController < BaseInventoryController
|
||||
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
@products = InventoryDefinition.all.active.order('created_at desc')
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -17,7 +17,7 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_item_code(order_item.item_code)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
@@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.item_code, print_status=" (Edited)" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,11 +4,12 @@ class Oqs::PrintController < ApplicationController
|
||||
unique_code="OrderItemPdf"
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
|
||||
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
|
||||
# Check Printed
|
||||
print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
|
||||
@@ -16,7 +17,7 @@ class Oqs::PrintController < ApplicationController
|
||||
# print when complete click
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, assigned_item.instance_code, print_status, options )
|
||||
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
|
||||
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
|
||||
@@ -43,6 +43,17 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
MenuCategory.current_menu
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_menu_sub_category ()
|
||||
id = params[:id]
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_product()
|
||||
@product = Product.all
|
||||
@@ -58,9 +69,6 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts "sssssssssss"
|
||||
puts params[:customer_id]
|
||||
puts params.to_json
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
class Origami::CheckInProcessController < BaseOrigamiController
|
||||
|
||||
def check_in_process
|
||||
dining_charge = DiningCharge.select('charge_type','charge_block')
|
||||
.where('dining_facility_id = ?',params[:dining_id])
|
||||
.first()
|
||||
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
checkout_at = Time.now.utc
|
||||
|
||||
if !dining_charge.nil?
|
||||
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
||||
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
||||
# if dining_charge.charge_type == 'hr'
|
||||
checkout_at = checkout_at + hr.hour + min.minutes
|
||||
# else
|
||||
|
||||
# end
|
||||
if !lookup_checkout_time.nil?
|
||||
if lookup_checkout_time[0][0] == 'hr'
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||
else
|
||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
@dining_facility.status = "occupied"
|
||||
@@ -25,9 +20,9 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
else
|
||||
type = "RoomBooking"
|
||||
end
|
||||
|
||||
|
||||
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||
:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign" })
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
@booking.save!
|
||||
|
||||
respond = {:status => 'ok'}
|
||||
|
||||
@@ -4,11 +4,20 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = sale_data.grand_total
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
if sale_payment.payment_method == "creditnote"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
@@ -21,6 +30,16 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote")
|
||||
|
||||
@@ -29,8 +29,6 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
# sale.save
|
||||
if discount_items.length > 0
|
||||
puts discount_items.to_json
|
||||
puts "dddddddddddd"
|
||||
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
@@ -159,11 +157,15 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
is_card = params[:is_card]
|
||||
sub_total = params[:sub_total]
|
||||
sale = Sale.find(sale_id)
|
||||
|
||||
if is_card == 'true'
|
||||
is_card = true
|
||||
else is_card.to_s == 'false'
|
||||
is_card = false
|
||||
end
|
||||
# Check for Card Payment
|
||||
is_card_payment = SaleItem.get_sale_payments_by_card(sale.sale_payments)
|
||||
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
||||
|
||||
if is_card_payment != true
|
||||
# if is_card != "true"
|
||||
account_types = Account.where("discount=?",true)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
@@ -180,8 +182,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
generic_customer_id = sale.customer.membership_id
|
||||
generic_customer_id = sale.customer.membership_id
|
||||
receipt_no = sale.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("member_discount")
|
||||
@@ -189,12 +190,13 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
campaign_type_id = memberaction.additional_parameter["campaign_type_id"]
|
||||
auth_token = memberaction.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
account_no = sale.customer.paypar_account_no rescue nil
|
||||
|
||||
# Check for items for Paypar Cloud
|
||||
if acc_prices.length > 0
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
:body => { account_no: nil,
|
||||
:body => { account_no: account_no,
|
||||
generic_customer_id:generic_customer_id ,
|
||||
campaign_type_id: campaign_type_id,
|
||||
receipt_no: receipt_no,
|
||||
@@ -221,8 +223,8 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
else
|
||||
response = {"status": false, "message": "You have no selected discount item" }
|
||||
end
|
||||
puts "discountttttttttttt"
|
||||
puts response.to_json
|
||||
Rails.logger.debug "-------------- Member Discount Osaka ---------"
|
||||
Rails.logger.debug response.to_json
|
||||
# Re-calc All Amount in Sale
|
||||
if response["status"] == true
|
||||
discount_amount = response["discount_earned"]
|
||||
@@ -239,7 +241,7 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
render :json => result.to_json
|
||||
|
||||
end #end Is Card Payment
|
||||
# end #end Is Card Payment
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.all.order('date desc')
|
||||
@shop = Shop.find_by_id(1)
|
||||
@shop = Shop::ShopDetail
|
||||
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
@@ -22,6 +22,10 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@dining.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Origami::InDutiesController < BaseOrigamiController
|
||||
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
||||
|
||||
# GET /in_duties
|
||||
# GET /in_duties.json
|
||||
def index
|
||||
|
||||
@@ -8,6 +8,15 @@ class Origami::JcbController < BaseOrigamiController
|
||||
total = sale_data.grand_total
|
||||
@jcbcount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "jcb"
|
||||
@jcbcount = @jcbcount + sale_payment.payment_amount
|
||||
@@ -26,6 +35,16 @@ class Origami::JcbController < BaseOrigamiController
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "jcb")
|
||||
|
||||
@@ -8,6 +8,15 @@ class Origami::MasterController < BaseOrigamiController
|
||||
total = sale_data.grand_total
|
||||
@mastercount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "master"
|
||||
@mastercount = @mastercount + sale_payment.payment_amount
|
||||
@@ -25,6 +34,16 @@ class Origami::MasterController < BaseOrigamiController
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "master")
|
||||
|
||||
@@ -8,6 +8,14 @@ class Origami::MpuController < BaseOrigamiController
|
||||
@mpucount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "mpu"
|
||||
@mpucount = @mpucount + sale_payment.payment_amount
|
||||
@@ -26,6 +34,16 @@ class Origami::MpuController < BaseOrigamiController
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||
|
||||
@@ -37,7 +37,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = di["price"]
|
||||
sale_item.taxable_price = di["price"] * 1
|
||||
sale_item.is_taxable = 1
|
||||
sale_item.is_taxable = di["is_taxable"]
|
||||
sale_item.account_id = 0
|
||||
|
||||
sale_item.price = di["price"] * 1
|
||||
|
||||
@@ -24,13 +24,30 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# Print for First Bill to Customer
|
||||
unique_code = "ReceiptBillPdf"
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
shop_details = Shop::ShopDetail
|
||||
# customer= Customer.where('customer_id=' +.customer_id)
|
||||
customer= Customer.find(sale_data.customer_id)
|
||||
customer = Customer.find(sale_data.customer_id)
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
a = sale_data.grand_total % 25 # Modulus
|
||||
b = sale_data.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
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)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
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(unique_code)
|
||||
@@ -44,7 +61,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance)
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -54,6 +71,22 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
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)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
@@ -75,16 +108,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# For Print
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
@@ -92,7 +126,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
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")
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -114,6 +148,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@accountable_type = ''
|
||||
@table_no = ''
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
|
||||
else
|
||||
new_total = @sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-@sale_data.grand_total
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
accounts = @customer.tax_profiles
|
||||
@@ -127,7 +169,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# get member information
|
||||
if @customer.membership_id != nil && rebate
|
||||
response = Customer.get_member_account(@customer)
|
||||
puts response.to_json
|
||||
if response["status"]==true
|
||||
response["account_data"].each do |res|
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
@@ -191,12 +232,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
shop_details = Shop::ShopDetail
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
@@ -206,7 +248,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
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, "Re-print")
|
||||
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, "Re-print",current_balance)
|
||||
end
|
||||
|
||||
def foc
|
||||
@@ -215,6 +257,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sub_total = params[:sub_total]
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
current_balance = nil
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
@@ -240,7 +283,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.find(1)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
@@ -249,7 +292,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
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, "FOC")
|
||||
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, "FOC",nil)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -259,14 +302,15 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@shop = Shop.find_by_id(1)
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
else
|
||||
new_total = saleObj.grand_total
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,6 +6,15 @@ class Origami::PayparPaymentsController < BaseOrigamiController
|
||||
payment_method = "paypar"
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
status,msg =sale_payment.process_payment(saleObj, @user, redeem_amount,payment_method)
|
||||
if status == true
|
||||
|
||||
@@ -5,76 +5,65 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
@membership_rebate_balance=0
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
# limit redeem_amount
|
||||
# rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
|
||||
# nonrebate_prices = sale_data.total_amount - rebate_prices
|
||||
# @payparcount = 0
|
||||
# others = 0
|
||||
# sale_data.sale_payments.each do |sale_payment|
|
||||
# if sale_payment.payment_method == "paypar"
|
||||
# @payparcount = @payparcount + sale_payment.payment_amount
|
||||
# else
|
||||
# others = others + sale_payment.payment_amount
|
||||
# end
|
||||
# end
|
||||
# non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
|
||||
# if non_rebate_exceed < 0
|
||||
# @redeem_prices = rebate_prices - @payparcount
|
||||
# else
|
||||
# @redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
|
||||
# end
|
||||
|
||||
@payparcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "paypar"
|
||||
@payparcount = @payparcount + sale_payment.payment_amount
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
end
|
||||
@redeem_prices = sale_data.grand_total - @payparcount -others
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
@payparcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "paypar"
|
||||
@payparcount = @payparcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@redeem_prices = sale_data.grand_total - @payparcount -others
|
||||
|
||||
|
||||
if sale_data
|
||||
if sale_data.customer_id
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if customer_data
|
||||
@membership_id = customer_data.membership_id
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
if member_actions.gateway_url
|
||||
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
if membership_data["status"]==true
|
||||
@membership_rebate_balance=membership_data["balance"]
|
||||
@out = true, @membership_rebate_balance,@membership_id
|
||||
end
|
||||
else
|
||||
@out =false,0
|
||||
end
|
||||
else
|
||||
@out = false,0
|
||||
end
|
||||
if sale_data
|
||||
if sale_data.customer_id
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if customer_data
|
||||
@membership_id = customer_data.membership_id
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
if member_actions.gateway_url
|
||||
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
merchant_uid= member_actions.merchant_account_id
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
if membership_data["status"]==true
|
||||
@membership_rebate_balance=membership_data["balance"]
|
||||
@out = true, @membership_rebate_balance,@membership_id
|
||||
end
|
||||
else
|
||||
@out =false,0
|
||||
end
|
||||
else
|
||||
@out = false,0
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
@out = false, 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,6 +19,10 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@room.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -43,7 +43,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * 1
|
||||
@newsaleitem.taxable_price = saleitemObj.taxable_price * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + ' (FOC)'
|
||||
|
||||
@@ -5,6 +5,10 @@ class Origami::SalesController < BaseOrigamiController
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.all.order('date desc')
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
@table_id = Booking.find(@booking).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
end
|
||||
|
||||
def add_to_existing_invoice
|
||||
|
||||
@@ -7,6 +7,15 @@ class Origami::VisaController < BaseOrigamiController
|
||||
total = sale_data.grand_total
|
||||
@visacount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@visacount = @visacount + sale_payment.payment_amount
|
||||
@@ -25,6 +34,17 @@ class Origami::VisaController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
# rounding adjustment
|
||||
if shop_details.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)
|
||||
end
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
#end rounding adjustment
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "visa")
|
||||
end
|
||||
|
||||
@@ -8,12 +8,19 @@ class Origami::VoidController < BaseOrigamiController
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
# update count for shift sale
|
||||
# if(sale.sale_status == "completed")
|
||||
if(sale.sale_status == "completed")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
# end
|
||||
else
|
||||
# void before sale payment complete
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.total_void = shift.total_void + sale.grand_total
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -73,6 +80,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
@@ -81,7 +89,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID")
|
||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance)
|
||||
|
||||
#end print
|
||||
|
||||
@@ -93,6 +101,5 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -7,6 +7,15 @@ class Origami::VoucherController < BaseOrigamiController
|
||||
total = sale_data.grand_total
|
||||
@vouchercount = 0
|
||||
others = 0
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "voucher"
|
||||
@vouchercount = @vouchercount + sale_payment.payment_amount
|
||||
|
||||
@@ -21,8 +21,6 @@ class Reports::PaymentMethodController < BaseReportController
|
||||
end
|
||||
@payment_type = params[:payment_type]
|
||||
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
|
||||
puts @pyament_method.to_json
|
||||
puts "sssssssssssss"
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
@@ -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')
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@ class Reports::SaleitemController < BaseReportController
|
||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
@sale_data, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
||||
puts @sale_data.to_json
|
||||
puts "SSSSSSSSSSS"
|
||||
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
def get_instance
|
||||
@id = MenuItemInstance.find(params[:id])
|
||||
puts "iddddddddd"
|
||||
puts @id.to_json
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_instances/1/edit
|
||||
@@ -67,12 +65,13 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||
else
|
||||
format.html { render :new }
|
||||
flash[:instance_code_error] = @settings_menu_item_instances.errors
|
||||
format.html { redirect_to new_settings_simple_menu_item_menu_item_instance_path }
|
||||
format.json { render json: @settings_menu_item_instances.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
@@ -105,9 +104,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
||||
@@ -154,6 +153,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
else
|
||||
@item = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
|
||||
# To Only show in Menu item selected attrs
|
||||
@item.item_attributes = MenuItemAttribute.where(id: @item.item_attributes).select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
||||
@@ -29,8 +29,12 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
if !@promotion.promo_end_hour.nil?
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
respond_to do |format|
|
||||
if @promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
@@ -95,16 +99,23 @@ class Settings::PromotionsController < ApplicationController
|
||||
|
||||
def find_parent_item
|
||||
res = []
|
||||
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item.nil?
|
||||
arr_inst = []
|
||||
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item_inst.nil?
|
||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
||||
res.push(product.name)
|
||||
res.push(product.item_code)
|
||||
else
|
||||
# menu_item = item.menu_item.pluck(:name,:item_code)
|
||||
res.push(item.item_instance_name)
|
||||
res.push(item.menu_item.item_code)
|
||||
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
||||
# res.push(item_inst.item_instance_name)
|
||||
# res.push(item_inst.menu_item.item_code)
|
||||
item_inst.menu_item.menu_item_instances.each do |inst|
|
||||
arr_inst.push({inst.item_instance_code => inst.item_instance_name})
|
||||
end
|
||||
res.push({item_inst.menu_item.item_code => arr_inst})
|
||||
end
|
||||
puts "res"
|
||||
p res
|
||||
render json: res
|
||||
end
|
||||
|
||||
|
||||
@@ -141,6 +141,6 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
|
||||
params.require(:set_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id,:account_id , :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit, :taxable)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -157,6 +157,6 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_menu_item_params
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit)
|
||||
params.require(:simple_menu_item).permit(:item_code, :name, :alt_name, :type, :image_path, :menu_category_id, :account_id, :item_attributes, :item_options, :min_qty, :is_sub_item, :is_available, :created_by, :item_sets, :unit, :taxable)
|
||||
end
|
||||
end
|
||||
|
||||
35
app/controllers/sym_control_controller.rb
Normal file
35
app/controllers/sym_control_controller.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
class SymControlController < BaseController
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
def run
|
||||
sym_path = "/home/yan/symmetric/"
|
||||
check_sym_proc_str = `#{"service SymmetricDS status"}`
|
||||
# Check Sym Installed
|
||||
# if sym_install_status[1] == "false"
|
||||
# response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
|
||||
# end
|
||||
|
||||
if check_sym_proc_str.include? "Active: active (running)" || "Active: active (exited)" #"Server is already running"
|
||||
# Create Sym Table
|
||||
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||
if check_sym_table
|
||||
sym_sql = Rails.root + "db/sym_master.sql"
|
||||
|
||||
if File.exist? (sym_sql)
|
||||
# Import Sym Sql to db and start sym
|
||||
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
stop_sym = system("service SymmetricDS stop")
|
||||
run_sym = system("service SymmetricDS start")
|
||||
if run_sym
|
||||
render :text => "<h1>Success!</h1>"
|
||||
end
|
||||
else
|
||||
render :text => "<h1>Sym Sql file not found!</h1>"
|
||||
end
|
||||
end
|
||||
else
|
||||
render :text => "<h1>Sym not running!</h1>"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4,7 +4,7 @@ class Transactions::BookingsController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
filter = params[:receipt_no]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil?
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search_credit_sales(customer,filter,from,to)
|
||||
if sale.count > 0
|
||||
|
||||
@@ -3,16 +3,13 @@ class Transactions::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
count = params[:count]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
|
||||
else
|
||||
orders = Order.search(filter,from,to,count)
|
||||
|
||||
orders = Order.search(filter,from,to)
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
|
||||
Reference in New Issue
Block a user