This commit is contained in:
phyusin
2018-04-11 18:01:46 +06:30
73 changed files with 1631 additions and 344 deletions

1
.code2lab.env Normal file
View File

@@ -0,0 +1 @@
RAILS_ENV=production

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
.git
.dockerignore

2
.gitignore vendored
View File

@@ -36,6 +36,8 @@ pickle-email-*.html
/gems/* /gems/*
._*.* ._*.*
.rbenv-version .rbenv-version
/config/initializers/*
config/deploy/config/* config/deploy/config/*
config/puma.rb config/puma.rb
#config/shops.json #config/shops.json

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM ruby:2.4.1
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
RUN mkdir /sxrestaurant
RUN mkdir -p /sxrestaurant/tmp/puma
ENV RAILS_ENV production
WORKDIR /sxrestaurant
COPY Gemfile /sxrestaurant/Gemfile
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
RUN bundle install --without development test
RUN bundle exec rails assets:precompile
COPY . /sxrestaurant

View File

@@ -163,7 +163,6 @@ For CloseCashierCustomisePdf in lookups
1) settings/print_settings 1) settings/print_settings
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 } 2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
<<<<<<< HEAD
<---- Extra Fields Script -----> <---- Extra Fields Script ----->
For MoveTablePdf in lookups For MoveTablePdf in lookups
*** Both Table and Room Moving *** *** Both Table and Room Moving ***
@@ -175,13 +174,12 @@ For MoveTablePdf in print settings
ii) Unique Code: MoveTablePdf ii) Unique Code: MoveTablePdf
iii)Template: ... iii)Template: ...
iv) Font: Zawgyi-One v) Printer: #printer name iv) Font: Zawgyi-One v) Printer: #printer name
=======
/* Tax Profile Group Types in lookups */ /* Tax Profile Group Types in lookups */
1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier } 1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service } 2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal } 3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
/* Tax Profile Group Types in lookups */ /* Tax Profile Group Types in lookups */
>>>>>>> 1c13b0469758fb968c0dfcc1f0a876ed2c5e395a
Add Kitchen Role of Employee Add Kitchen Role of Employee
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen } => 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }

View File

@@ -974,7 +974,7 @@ console.log(d_option)
dataType: "json", dataType: "json",
success:function(result){ success:function(result){
if (result.status) { if (result.status) {
console.log(result)
if (result.data == null){ if (result.data == null){
swal({ swal({
title: "Please Open Shift !", title: "Please Open Shift !",
@@ -987,6 +987,8 @@ console.log(d_option)
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
}); });
}else if(result.data == 'OK'){
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
}else{ }else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment" window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
} }

View File

@@ -336,8 +336,24 @@ function resCardSaleTrans(card_sale_trans_id,cmd_type,payment_type, bnk_bill_amo
} }
}); });
}else{ }else{
if(payment_type!="master"){
payment_type = payment_type.toUpperCase();
}else{
payment_type = "Master";
}
$("#loading_wrapper").hide(); $("#loading_wrapper").hide();
swal ( "Oops" , resMsg.toString() , "error" ); swal({
title: 'Oops',
text: resMsg.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/"+payment_type;
});
} }
} }

View File

@@ -417,6 +417,14 @@ i.logout_icon{
#is_memberModal .btn { #is_memberModal .btn {
width: 80%; width: 80%;
} }
#is_paymemberModal .modal-body {
height: 150px !important;
}
#is_paymemberModal .btn {
width: 80%;
}
/* End Is Member Modal */ /* End Is Member Modal */
/* Start iframe */ /* Start iframe */

View File

@@ -1,7 +1,8 @@
class Api::ApiController < ActionController::API class Api::ApiController < ActionController::API
include TokenVerification include TokenVerification
helper_method :current_token, :current_login_employee, :get_cashier
before_action :lookup_domain
helper_method :current_token, :current_login_employee, :get_cashier
private private
#this is base api base controller to need to inherit. #this is base api base controller to need to inherit.
@@ -21,4 +22,32 @@ class Api::ApiController < ActionController::API
def current_login_employee def current_login_employee
@employee = Employee.find_by_token_session(current_token) @employee = Employee.find_by_token_session(current_token)
end end
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.dbhost
ActiveRecord::Base.establish_connection(website_connection(@license))
# authenticate_session_token
# 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
def cache_license(url, lookup)
@license = License.new(url, lookup)
if (@license.detail_with_local_cache(lookup) == true)
return @license
else
return nil
end
end
end end

View File

@@ -1,5 +1,5 @@
class Api::BookingsController < Api::ApiController class Api::BookingsController < Api::ApiController
skip_before_action :authenticate # skip_before_action :authenticate
#Show customer by ID #Show customer by ID
def index def index
@customer = Customer.find_by(params[:id]) @customer = Customer.find_by(params[:id])

View File

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

View File

@@ -1,5 +1,5 @@
class Api::CheckInProcessController < Api::ApiController class Api::CheckInProcessController < Api::ApiController
# before_action :authenticate
def check_in_time def check_in_time
if params[:dining_id] if params[:dining_id]
dining_facility = DiningFacility.find(params[:dining_id]) dining_facility = DiningFacility.find(params[:dining_id])
@@ -49,7 +49,7 @@ class Api::CheckInProcessController < Api::ApiController
arr_time = checkout_time[0].split("-") arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p")
if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time if start_time <= today.strftime("%H:%M%p") && today.strftime("%H:%M%p") <= end_time
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end end
end end

View File

@@ -0,0 +1,67 @@
class Api::OrderReserve::OrderReservationController < Api::ApiController
# skip_before_action :authenticate
ORDER = "order"
RESERVATION = "reservation"
ORDER_RESERVATION = "order_and_reservation"
def check_customer
customer_id = 0
if !params[:name]
render :json => { :status => false, :message => "name is required!" }
elsif !params[:email]
render :json => { :status => false, :message => "email is required!" }
elsif !params[:membership_id]
render :json => { :status => false, :message => "membership_id is required!" }
end
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = Customer.addCustomer(params)
customer_id = customer.id
end
render :json => { :status => true, :data => { :customer_id => customer_id} }
end
def create
status = false
if !params[:cus_info]
render :json => { :status => false, :message => "cus_info is required!" }
elsif !params[:requested_time]
render :json => { :status => false, :message => "requested_time is required!" }
elsif !params[:callback_url]
render :json => { :status => false, :message => "callback_url is required!" }
elsif !params[:reference]
render :json => { :status => false, :message => "reference is required!" }
elsif !params[:order_type]
render :json => { :status => false, :message => "order_type is required!" }
elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION
if !params[:order_info]
render :json => { :status => false, :message => "order_info is required!" }
else
status = true
end
elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION
if !params[:reservation_info]
render :json => { :status => false, :message => "reservation_info is required!" }
else
status = true
end
elsif !params[:payment_info]
render :json => { :status => false, :message => "payment_info is required!" }
elsif !params[:delivery_info]
render :json => { :status => false, :message => "delivery_info is required!" }
end
if status == true
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(params)
if flag
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
else
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
end
end
end
end

View File

@@ -1,5 +1,5 @@
class Api::OrdersController < Api::ApiController class Api::OrdersController < Api::ApiController
skip_before_action :authenticate # skip_before_action :authenticate
#Description #Description
# This API show current order details # This API show current order details
# Input Params - order_id # Input Params - order_id

View File

@@ -15,8 +15,15 @@ module TokenVerification
def authenticate_token def authenticate_token
authenticate_with_http_token do |token, options| authenticate_with_http_token do |token, options|
#@current_user = User.find_by(api_key: token) # Rails.logger.debug "token - " + token.to_s
Rails.logger.debug "token - " + token.to_s if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
end
end
@user = Employee.authenticate_by_token(token) @user = Employee.authenticate_by_token(token)
if @user if @user
return true return true

View File

@@ -6,7 +6,7 @@ class Origami::AlipayController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@alipaycount = 0 @alipaycount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_alipay = 0 @can_alipay = 0
@member_discount = 0 @member_discount = 0
@@ -54,7 +54,7 @@ class Origami::AlipayController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

@@ -9,7 +9,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
@creditcount = 0 @creditcount = 0
others = 0 others = 0
@shop = Shop::ShopDetail @shop = Shop.first
if @shop.is_rounding_adj if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total) new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else else
@@ -32,7 +32,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
sale_id = params[:sale_id] sale_id = params[:sale_id]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj if shop_details.is_rounding_adj

View File

@@ -145,4 +145,31 @@ class Origami::CustomersController < BaseOrigamiController
end end
end end
def send_account
amount = params[:amount]
account_no = params[:account_no]
receipt_no = params[:receipt_no]
sale = Sale.find_by_receipt_no(receipt_no)
@out = []
action_by = current_user.id
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 = nil
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_data(url,membership_setting.auth_token,merchant_uid,auth_token,account_no,amount,receipt_no)
if membership_data["status"]==true
remark = "Payment by account no Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} | Transaction ref: #{membership_data[:transaction_ref]} | Reload amount #{membership_data[:reload_amount]} | Old Balance Amount #{membership_data[:old_balance_amount]} | DateTime : #{membership_data[:date]}"
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"PAYBYACCOUNT" )
else
remark = "Payment by account no Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} | Remark : #{membership_data[:message]}"
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_id, action_by,remark,"PAYBYACCOUNT" )
end
@out = membership_data
end
end
end
end end

View File

@@ -5,8 +5,8 @@ class Origami::DingaController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@membership_rebate_balance=0 @membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop::ShopDetail @shop = Shop.first
# if @shop.is_rounding_adj # if @shop.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total) # new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
# else # else
@@ -15,16 +15,16 @@ class Origami::DingaController < BaseOrigamiController
# @rounding_adj = new_total-sale_data.grand_total # @rounding_adj = new_total-sale_data.grand_total
@rounding_adj = sale_data.rounding_adjustment @rounding_adj = sale_data.rounding_adjustment
@dingacount = 0 @payparcount = 0
others = 0 others = 0
sale_data.sale_payments.each do |sale_payment| sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "dinga" if sale_payment.payment_method == "dinga"
@dingacount = @dingacount + sale_payment.payment_amount @payparcount = @payparcount + sale_payment.payment_amount
else else
others = others + sale_payment.payment_amount others = others + sale_payment.payment_amount
end end
end end
@redeem_prices = sale_data.grand_total - @dingacount -others @payment_prices = sale_data.grand_total - @payparcount -others
if sale_data if sale_data
@@ -33,15 +33,15 @@ class Origami::DingaController < BaseOrigamiController
if customer_data if customer_data
@membership_id = customer_data.membership_id @membership_id = customer_data.membership_id
if !@membership_id.nil? if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("dinga_url") membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance") member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url if member_actions.gateway_url
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"] @campaign_type_id = nil
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
merchant_uid= member_actions.merchant_account_id merchant_uid= member_actions.merchant_account_id
auth_token = member_actions.auth_token.to_s auth_token = member_actions.auth_token.to_s
membership_data = SalePayment.get_dinga_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) 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 if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"] @membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id @out = true, @membership_rebate_balance,@membership_id
@@ -67,36 +67,31 @@ class Origami::DingaController < BaseOrigamiController
@out = false, 0 @out = false, 0
end end
@out = false, 0 @out = false, 0
end end
def create def create
cash = params[:payment_amount]
sale_id = params[:sale_id] sale_id = params[:sale_id]
@cashier_type = params[:type] transaction_ref = params[:transaction_ref]
redeem_amount = params[:redeem_amount]
membership_id = params[:membership_id]
payment_method = "dinga"
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj # if shop_details.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total) # new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-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) # saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end # end
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status,msg =sale_payment.process_payment(saleObj, @user, redeem_amount,payment_method) status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",transaction_ref)
if status == true if status == true
@out = true, "Success!" @out = true, "Success!"
else else
@out =false, "Please try again payment!" @out =false, "Please try again payment!"
end end
else
@out = false, "There has no sale record!"
end end
end end
end end

View File

@@ -8,7 +8,7 @@ class Origami::HomeController < BaseOrigamiController
@rooms = Room.all.active.order('status desc') @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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@shop = Shop::ShopDetail @shop = Shop.first
# @shift = ShiftSale.current_open_shift(current_user.id) # @shift = ShiftSale.current_open_shift(current_user.id)
end end
@@ -26,7 +26,7 @@ class Origami::HomeController < BaseOrigamiController
@status_sale = "" @status_sale = ""
@sale_array = Array.new @sale_array = Array.new
@shop = Shop::ShopDetail @shop = Shop.first
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all

View File

@@ -7,7 +7,7 @@ class Origami::JcbController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@jcbcount = 0 @jcbcount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_jcb = 0 @can_jcb = 0
@member_discount= 0 @member_discount= 0
@@ -56,7 +56,7 @@ class Origami::JcbController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

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

View File

@@ -7,7 +7,7 @@ class Origami::MasterController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@mastercount = 0 @mastercount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_master = 0 @can_master = 0
@member_discount = 0 @member_discount = 0
@@ -53,7 +53,7 @@ class Origami::MasterController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

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

View File

@@ -6,7 +6,7 @@ class Origami::MpuController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@mpucount = 0 @mpucount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_mpu = 0 @can_mpu = 0
@member_discount = 0 @member_discount = 0
@@ -54,7 +54,7 @@ class Origami::MpuController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

@@ -0,0 +1,12 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
@webview = check_mobile
@shop = Shop::ShopDetail
end
end

View File

@@ -5,8 +5,8 @@ class Origami::PaymalController < BaseOrigamiController
@cashier_type = params[:type] @cashier_type = params[:type]
@membership_rebate_balance=0 @membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop::ShopDetail @shop = Shop.first
# if @shop.is_rounding_adj # if @shop.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total) # new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
# else # else
@@ -67,13 +67,15 @@ class Origami::PaymalController < BaseOrigamiController
@out = false, 0 @out = false, 0
end end
@out = false, 0 @out = false, 0
end end
def create
def create
cash = params[:payment_amount] cash = params[:payment_amount]
sale_id = params[:sale_id] sale_id = params[:sale_id]
transaction_ref = params[:transaction_ref]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj
@@ -84,7 +86,7 @@ class Origami::PaymalController < BaseOrigamiController
# saleObj = Sale.find(sale_id) # saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal") status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",transaction_ref)
if status == true if status == true
@out = true, "Success!" @out = true, "Success!"
else else
@@ -92,10 +94,4 @@ class Origami::PaymalController < BaseOrigamiController
end end
end end
end end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end end

View File

@@ -44,7 +44,7 @@ class Origami::PaymentsController < BaseOrigamiController
end end
#shop detail #shop detail
shop_details = Shop::ShopDetail shop_details = Shop.first
# customer= Customer.where('customer_id=' +.customer_id) # customer= Customer.where('customer_id=' +.customer_id)
customer = Customer.find(sale_data.customer_id) customer = Customer.find(sale_data.customer_id)
# rounding adjustment # rounding adjustment
@@ -99,7 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj if shop_details.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus a = saleObj.grand_total % 25 # Modulus
@@ -238,7 +238,7 @@ class Origami::PaymentsController < BaseOrigamiController
@dining = '' @dining = ''
@other_payment = 0.0 @other_payment = 0.0
@shop = Shop::ShopDetail #show shop info @shop = Shop.first #show shop info
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'") @customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
@@ -391,7 +391,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id) customer= Customer.find(saleObj.customer_id)
#shop detail #shop detail
shop_details = Shop::ShopDetail shop_details = Shop.first
# get member information # get member information
rebate = MembershipSetting.find_by_rebate(1) rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate if customer.membership_id != nil && rebate
@@ -475,7 +475,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id) customer= Customer.find(saleObj.customer_id)
#shop detail #shop detail
shop_details = Shop::ShopDetail shop_details = Shop.first
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)

View File

@@ -7,7 +7,7 @@ class Origami::PayparPaymentsController < BaseOrigamiController
payment_method = "paypar" payment_method = "paypar"
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj if shop_details.is_rounding_adj

View File

@@ -155,6 +155,9 @@ class Origami::QuickServiceController < ApplicationController
result = {:status=> true, :data => @sale } result = {:status=> true, :data => @sale }
render :json => result.to_json render :json => result.to_json
end end
elsif (params[:sale_id][0,3] == "BKI")
result = {:status=> true, :data => 'OK' }
render :json => result.to_json
else else
result = {:status=> true, :data => nil } result = {:status=> true, :data => nil }
render :json => result.to_json render :json => result.to_json

View File

@@ -6,7 +6,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
@membership_rebate_balance=0 @membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
@shop = Shop::ShopDetail @shop = Shop.first
# if @shop.is_rounding_adj # if @shop.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total) # new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
# else # else

View File

@@ -16,7 +16,12 @@ class Origami::RequestBillsController < ApplicationController
bk_order = BookingOrder.find_by_order_id(order_id) bk_order = BookingOrder.find_by_order_id(order_id)
order = Order.find(order_id) order = Order.find(order_id)
check_booking = Booking.find_by_booking_id(bk_order.booking_id) check_booking = Booking.find_by_booking_id(bk_order.booking_id)
if check_booking.dining_facility_id.to_i > 0
table = DiningFacility.find(check_booking.dining_facility_id) table = DiningFacility.find(check_booking.dining_facility_id)
else
table = nil
end
if check_booking.sale_id.nil? if check_booking.sale_id.nil?
# Create Sale if it doesn't exist # Create Sale if it doesn't exist
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source) @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)

View File

@@ -28,7 +28,7 @@ class Origami::RoomsController < BaseOrigamiController
@status_sale = "" @status_sale = ""
@sale_array = Array.new @sale_array = Array.new
@shop = Shop::ShopDetail @shop = Shop.first
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all

View File

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

View File

@@ -6,7 +6,7 @@ class Origami::UnionpayController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@unionpaycount = 0 @unionpaycount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_unionpay = 0 @can_unionpay = 0
@member_discount = 0 @member_discount = 0
@@ -51,7 +51,7 @@ class Origami::UnionpayController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

@@ -6,7 +6,7 @@ class Origami::VisaController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id) sale_data = Sale.find_by_sale_id(@sale_id)
total = 0 total = 0
@visacount = 0 @visacount = 0
@shop = Shop::ShopDetail @shop = Shop.first
@rounding_adj = 0 @rounding_adj = 0
@can_visa = 0 @can_visa = 0
@member_discount = 0 @member_discount = 0
@@ -51,7 +51,7 @@ class Origami::VisaController < BaseOrigamiController
ref_no = params[:ref_no] ref_no = params[:ref_no]
if(Sale.exists?(sale_id)) if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
# if shop_details.is_rounding_adj # if shop_details.is_rounding_adj

View File

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

View File

@@ -99,11 +99,11 @@ class Settings::MenusController < ApplicationController
sheet.add_row ["Name",menu.name], :style=>title sheet.add_row ["Name",menu.name], :style=>title
sheet.add_row sheet.add_row
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Item AltName", "Taxable", "Instance Code", "Instance Name", "Price"], :style=>header_text sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Instance Code", "Instance Name", "Price"], :style=>header_text
menu.menu_categories.each do |mc| menu.menu_categories.each do |mc|
mc.menu_items.each do |mi| mc.menu_items.each do |mi|
mi.menu_item_instances.each do |mii| mi.menu_item_instances.each do |mii|
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.alt_name, mi.taxable, mii.item_instance_code, mii.item_instance_name, mii.price], :style=>wrap_text sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, mii.item_instance_code, mii.item_instance_name, mii.price], :style=>wrap_text
end end
end end
end end

View File

@@ -9,10 +9,10 @@ class Customer < ApplicationRecord
has_many :orders has_many :orders
has_many :sales has_many :sales
validates_presence_of :name, :contact_no, :email,:card_no validates_presence_of :name, :contact_no, :email #,:card_no
validates :contact_no, uniqueness: true, numericality: true validates :contact_no, uniqueness: true, numericality: true
validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create } validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
validates :card_no, uniqueness: true # validates :card_no, uniqueness: true
# validates :paypar_account_no, uniqueness: true # validates :paypar_account_no, uniqueness: true
paginates_per 50 paginates_per 50
@@ -352,6 +352,23 @@ class Customer < ApplicationRecord
end end
#new customer for doemal
def self.addCustomer(params)
customer = Customer.new
customer.name = params[:name]
customer.email = params[:email]
customer.contact_no = params[:contact_no]
customer.gender = params[:gender]
customer.address = params[:address]
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
customer.membership_id = params[:membership_id]
customer.customer_type = "Takeaway"
customer.tax_profiles = ["2"]
customer.save
return customer
end
WALKIN = "CUS-000000000001" WALKIN = "CUS-000000000001"
TAKEAWAY = "CUS-000000000002" TAKEAWAY = "CUS-000000000002"

16
app/models/delivery.rb Normal file
View File

@@ -0,0 +1,16 @@
class Delivery < ApplicationRecord
belongs_to :order_reservation
def self.addDeliveryInfo(params,order_reservation_id)
delivery = Delivery.new
delivery.order_reservation_id = order_reservation_id
delivery.provider = params[:provider]
delivery.delivery_type = params[:delivery_type]
delivery.township = params[:township]
delivery.address = params[:address]
delivery.direction_address = params[:address_direction]
delivery.delivery_fee = params[:delivery_fee]
delivery.remark = params[:delivery_note]
delivery.save!
end
end

View File

@@ -140,14 +140,6 @@ class Menu < ApplicationRecord
end end
else else
# Menu by Menu Import # Menu by Menu Import
accs = Account.all
account_id = 1
if accs.length > 0
account_id = accs[0].id
else
status = "No Account Created."
end
sheet = spreadsheet.sheet(0) sheet = spreadsheet.sheet(0)
menu = sheet.row(1)[1] menu = sheet.row(1)[1]
imported_menu = Menu.create({name: menu, is_active: true, valid_days: "1,2,3,4,5,6,7",valid_time_from: "00:00:00", valid_time_to: "23:59:59", created_by: created_by}) imported_menu = Menu.create({name: menu, is_active: true, valid_days: "1,2,3,4,5,6,7",valid_time_from: "00:00:00", valid_time_to: "23:59:59", created_by: created_by})
@@ -163,7 +155,12 @@ class Menu < ApplicationRecord
menu_itm = MenuItem.find_by_item_code(row["Item Code"]) menu_itm = MenuItem.find_by_item_code(row["Item Code"])
if !menu_itm if !menu_itm
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", account_id: account_id, is_sub_item: 0, is_available: 1, created_by: created_by) account = Account.find_by_title(row["Account"])
if account.nil?
account = Account.create({title: row["Account"], account_type: "0"})
end
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: "", description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: "[]", item_options: "[]", account_id: account_id, is_sub_item: 0, is_available: 1, created_by: created_by)
# else # else
# status = status + "Item Code already exists for " + row["Item Name"] + "." # status = status + "Item Code already exists for " + row["Item Name"] + "."
end end

View File

@@ -56,6 +56,21 @@ class MyAesCrypt
return aes_key, aes_iv return aes_key, aes_iv
end end
def checkKeyForAuth(from,token)
file_path = "config/shops.json"
shop_data = File.read(file_path)
shop_json = JSON.parse(shop_data)
shop_json["data"].each do |j|
if j["lookup"] == from
if(j["value"]["key"] == token)
return true
end
end
end
return false
end
private private
def encrypt(data) def encrypt(data)
cipher.encrypt cipher.encrypt

View File

@@ -0,0 +1,55 @@
class OrderReservation < ApplicationRecord
self.primary_key = "order_reservation_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
has_many :order_reservation_items
belongs_to :delivery
def self.addOrderReservationInfo(params)
check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference])
if check_order_reservation.empty?
order_reservation = OrderReservation.new
order_reservation.order_reservation_type = params[:order_type]
order_reservation.customer_id = params[:cus_info]
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.callback_url = params[:callback_url]
order_reservation.transaction_ref = params[:reference]
if params[:order_info]
order_reservation.item_count = params[:order_info][:items].count
order_reservation.payment_type = params[:payment_info][:payment_type]
order_reservation.payment_status = params[:payment_info][:payment_status]
order_reservation.payment_ref = params[:payment_info][:payment_ref]
order_reservation.total_amount = params[:payment_info][:sub_total]
order_reservation.total_tax = params[:payment_info][:total_tax]
order_reservation.discount_amount = params[:payment_info][:discount_amount]
order_reservation.grand_total = params[:payment_info][:grand_total]
order_reservation.order_remark = params[:order_info][:order_remark]
end
if params[:reservation_info]
order_reservation.total_customer = params[:reservation_info][:total_user]
order_reservation.reservation_remark = params[:reservation_info][:reservation_note]
end
order_reservation.save!
if params[:order_info][:items]
params[:order_info][:items].each do |oritem|
OrderReservationItem.process_order_reservation_item(oritem[:product_code],oritem[:item_instance_code],oritem[:product_name],oritem[:product_alt_name],
oritem[:account_id],oritem[:qty],oritem[:price],oritem[:unit_price],
oritem[:options],nil,order_reservation.id)
end
end
if params[:delivery_info]
Delivery.addDeliveryInfo(params[:delivery_info],order_reservation.id)
end
return order_reservation.id, true
else
return check_order_reservation[0].id, false
end
end
private
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")
end
end

View File

@@ -0,0 +1,32 @@
class OrderReservationItem < ApplicationRecord
self.primary_key = "order_reservation_items_id"
#primary key - need to be unique
before_create :generate_custom_id
belongs_to :order_reservation, autosave: true
def self.process_order_reservation_item (item_code, instance_code, menu_name, alt_name, account_id, qty, price, unit_price, options, set_menu_items, order_reservation_id)
orderreservationitem = OrderReservationItem.create do |oitem|
oitem.order_reservation_id = order_reservation_id
oitem.item_code = item_code
oitem.item_instance_code = instance_code
oitem.item_name = menu_name
oitem.alt_name = alt_name ? alt_name : ""
oitem.account_id = account_id
oitem.qty = qty
oitem.unit_price = unit_price
oitem.price = price
oitem.options = options
oitem.set_menu_items = set_menu_items
end
#logger.debug orderitem.to_yml
orderreservationitem.save!
end
private
def generate_custom_id
self.order_reservation_items_id = SeedGenerator.generate_id(self.class.name, "ODRSI")
end
end

View File

@@ -1,6 +1,6 @@
class PrintSetting < ApplicationRecord class PrintSetting < ApplicationRecord
# validations # validations
validates_presence_of :name, :unique_code, :printer_name, :brand_name, :api_settings, :page_width, :page_height, :print_copies, :header_font_size, :item_font_size validates_presence_of :name, :unique_code, :printer_name, :api_settings, :page_width, :page_height, :print_copies, :header_font_size, :item_font_size
def self.get_precision_delimiter def self.get_precision_delimiter
PrintSetting.find_by_unique_code("ReceiptBillPdf") PrintSetting.find_by_unique_code("ReceiptBillPdf")

View File

@@ -535,7 +535,7 @@ class Sale < ApplicationRecord
end end
def adjust_rounding def adjust_rounding
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj if shop_details.is_rounding_adj
a = self.grand_total % 25 # Modulus a = self.grand_total % 25 # Modulus
@@ -555,7 +555,7 @@ class Sale < ApplicationRecord
end end
def compute_adjust_rounding(grand_total) def compute_adjust_rounding(grand_total)
shop_details = Shop::ShopDetail shop_details = Shop.first
# rounding adjustment # rounding adjustment
if shop_details.is_rounding_adj if shop_details.is_rounding_adj
a = grand_total % 25 # Modulus a = grand_total % 25 # Modulus
@@ -577,7 +577,7 @@ class Sale < ApplicationRecord
#Generate new Receipt No when it is not assigned #Generate new Receipt No when it is not assigned
def generate_receipt_no def generate_receipt_no
#shop_code and client_code #shop_code and client_code
shop_details = Shop::ShopDetail shop_details = Shop.first
#Date-Shift- #Date-Shift-
if self.receipt_no.nil? if self.receipt_no.nil?
@@ -2592,6 +2592,7 @@ end
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id") query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
.joins("join orders as orders on orders.order_id = sale_orders.order_id") .joins("join orders as orders on orders.order_id = sale_orders.order_id")
query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service") query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service")
.group("sales.sale_id")
end end
def self.pending_order def self.pending_order
query = Booking.all query = Booking.all

View File

@@ -103,6 +103,31 @@ class SalePayment < ApplicationRecord
rescue OpenURI::HTTPError rescue OpenURI::HTTPError
response = { status: false} response = { status: false}
rescue SocketError
response = { status: false}
end
Rails.logger.debug "Get Paypar Account "
Rails.logger.debug response.to_json
return response
end
def self.get_paypar_account_data(url,token,merchant_uid,auth_token,account_no,amount,receipt_no)
# Control for Paypar Cloud
begin
response = HTTParty.get(url,
:body => { merchant_uid:merchant_uid,auth_token:auth_token,receipt_no: receipt_no,
account_no: account_no, amount: amount}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10
)
rescue Net::OpenTimeout
response = { status: false }
rescue OpenURI::HTTPError
response = { status: false}
rescue SocketError rescue SocketError
response = { status: false} response = { status: false}
end end
@@ -378,7 +403,7 @@ class SalePayment < ApplicationRecord
self.payment_amount = self.received_amount self.payment_amount = self.received_amount
self.payment_reference = self.voucher_no self.payment_reference = self.voucher_no
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "pending" self.payment_status = "paid"
payment_method = self.save! payment_method = self.save!
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid') SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
sale_update_payment_status(self.received_amount.to_f) sale_update_payment_status(self.received_amount.to_f)
@@ -410,10 +435,10 @@ class SalePayment < ApplicationRecord
#Next time - validate if the vochure number is valid - within #Next time - validate if the vochure number is valid - within
customer_data = Customer.find_by_customer_id(self.sale.customer_id) customer_data = Customer.find_by_customer_id(self.sale.customer_id)
membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) membership_data = SalePayment.create_payment(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
#record an payment in sale-audit #record an payment in sale-audit
remark = "#{membership_data} Redeem- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " remark = "#{membership_data} Dinga Payment- for Customer #{self.sale.customer_id} Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1) sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
if membership_data["status"]==true if membership_data["status"]==true
@@ -421,7 +446,7 @@ class SalePayment < ApplicationRecord
self.payment_amount = self.received_amount self.payment_amount = self.received_amount
self.payment_reference = self.voucher_no self.payment_reference = self.voucher_no
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "pending" self.payment_status = "paid"
payment_method = self.save! payment_method = self.save!
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid') SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
sale_update_payment_status(self.received_amount.to_f) sale_update_payment_status(self.received_amount.to_f)
@@ -429,6 +454,7 @@ class SalePayment < ApplicationRecord
else else
sale_update_payment_status(0) sale_update_payment_status(0)
end end
return payment_status return payment_status
end end

View File

@@ -4,8 +4,8 @@ class OrderSummarySetPdf < Prawn::Document
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty) def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
self.page_height = print_settings.page_height self.page_height = print_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = printer_settings.item_font_size.to_i self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.price_width = 40 # No Need for item self.price_width = 40 # No Need for item
self.qty_width = 40 self.qty_width = 40

View File

@@ -4,8 +4,8 @@ class OrderSummarySlimPdf < Prawn::Document
def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty) def initialize(print_settings,order, print_status, order_items = nil,alt_name,before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
self.page_height = print_settings.page_height self.page_height = print_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = printer_settings.item_font_size.to_i self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0 self.margin = 0
self.price_width = 40 # No Need for item self.price_width = 40 # No Need for item
self.qty_width = 40 self.qty_width = 40

View File

@@ -34,6 +34,14 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div> <div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
</div> </div>
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
<div class="info-box bg-blue">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :order_reservation %></div>
</div>
</div>
</div> </div>
<!-- #END# Widgets --> <!-- #END# Widgets -->
<% if !@current_user.nil? && @current_user.role != 'waiter' %> <% if !@current_user.nil? && @current_user.role != 'waiter' %>
@@ -200,7 +208,10 @@
$(".qs_view").on('click', function() { $(".qs_view").on('click', function() {
document.getElementById('second_view').click(); document.getElementById('second_view').click();
window.location.href = '/origami/quick_service'; window.location.href = '/origami/quick_service';
});
$(".order_reservation").on('click', function() {
window.location.href = '/origami/order_reservation';
}); });
$("#second_view").on('click', function () { $("#second_view").on('click', function () {

View File

@@ -15,41 +15,41 @@
<div class="rebate-form"> <div class="rebate-form">
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">You can redeem up to </label> <label class="">You can pay up to </label>
<%@redeem_prices = @redeem_prices +@rounding_adj%> <%@payment_prices = @payment_prices +@rounding_adj%>
<input type="text" name="" id="redeemamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @redeem_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>"> <input type="text" name="" id="paymentamt" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payment_prices %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div> </div>
<hr> <hr>
</div> </div>
<% if @dingacount > 0 %> <% if @payparcount > 0 %>
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">Recent Redeem Amount </label> <label class="">Recent Payment Amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @dingacount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>"> <input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @payparcount %>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div> </div>
<hr> <hr>
</div> </div>
<% end %> <% end %>
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class=""> Rebate Balance </label> <label class="">Available Balance </label>
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>"> <input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
</div> </div>
<hr> <hr>
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">Redeem Amount</label> <label class="">Payment Balance</label>
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div> <div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
</div> </div>
<hr> <hr>
</div> </div>
</div> </div>
</div> </div>
<!-- <% if @dingacount > 0 %> <!-- <% if @payparcount > 0 %>
<p class="">Last time rebate amount is <%= @dingacount %></p> <p class="">Last time rebate amount is <%= @payparcount %></p>
<% end %> <% end %>
<p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @redeem_prices %></span></p> --> <p class="">You can rebate upto <span style="color:red;" id="food_prices"><%= @payment_prices %></span></p> -->
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
@@ -92,7 +92,7 @@
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div> <div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
</div> </div>
<div class="row bottom m-l-5"> <div class="row bottom m-l-5">
<div class="pay purple left" id="dinga">Pay</div> <div class="pay purple left" id="dinga_payment">Pay</div>
</div> </div>
</div> </div>
@@ -106,15 +106,43 @@
</div> </div>
</div> </div>
</div> </div>
<!-- customer light box -->
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
setHeaderBreadCrumb(_REDEEM_PAYMENT_); setHeaderBreadCrumb(_DINGA_);
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){} if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else { else {
$('#redeemamt').attr("value",parseFloat("<%= @redeem_prices %>") - parseFloat(localStorage.getItem("cash"))); $('#paymentamt').attr("value",parseFloat("<%= @payment_prices %>") - parseFloat(localStorage.getItem("cash")));
} }
}); });
$(document).on('click', '.cashier_number', function(event){ $(document).on('click', '.cashier_number', function(event){
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@@ -148,7 +176,7 @@
$('#used_amount').text(cash.substr(0,cash.length-1)); $('#used_amount').text(cash.substr(0,cash.length-1));
break; break;
case 'nett': case 'nett':
var remain_amount = $('#redeemamt').val(); var remain_amount = $('#paymentamt').val();
$('#used_amount').text(remain_amount); $('#used_amount').text(remain_amount);
break; break;
@@ -159,22 +187,23 @@
} }
}); });
$("#dinga").click(function(){ $("#dinga_payment").click(function(){
valid_amount = $("#valid_amount").val(); valid_amount = $("#valid_amount").val();
sale_id = $("#valid_amount").attr('data-value'); sale_id = $("#valid_amount").attr('data-value');
membership_id = $("#valid_amount").attr('data-member-value'); membership_id = $("#valid_amount").attr('data-member-value');
redeem_amount = parseFloat($("#used_amount").text()); payment_amount = parseFloat($("#used_amount").text());
if(redeem_amount<=0 ){ if((membership_id!=undefined) && (membership_id!="") && (membership_id > 0)){
if(payment_amount<=0 ){
swal ( "Oops" , "Please type valid amount!" , "warning" ); swal ( "Oops" , "Please type valid amount!" , "warning" );
}else if(valid_amount< redeem_amount){ }else if(valid_amount< payment_amount){
swal ( "Oops" , "Insufficient Amount!" , "warning" ); swal ( "Oops" , "Insufficient Amount!" , "warning" );
}else{ }else{
if(redeem_amount <= "<%= @redeem_prices %>"){ if(payment_amount <= "<%= @payment_prices %>"){
$(this).off("click"); $(this).off("click");
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_dinga_path%>", url: "<%=origami_payment_dinga_path%>",
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id}, data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
@@ -194,8 +223,201 @@
} }
}) })
}else { }else {
swal ( "Oops" , "Redeem Amount is over!" , "warning" ); swal ( "Oops" , "Payment Amount is over!" , "warning" );
}
}
}else{
$("#is_paymemberModal").modal({show : true, backdrop: false, keyboard : false});
}
});
// Read Card Reader
$(".btn_member").on('click', function(){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var customer_mamber_card_no = 0;
$("#is_paymemberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount));
$.ajax({
type: "POST",
url: "<%=origami_payment_dinga_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Information" , result.message);
} }
} }
}); });
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
});
}
}
});
}
},100);
});
// Read NFC card no from java
function getCardNo(){
code2lab.readNFC();
}
// get CardNo from Java
function setCardNo(cardNo){
if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo);
}
}
// QR Code Reader
$(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide();
var code = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
setTimeout(function(){
code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount));
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Information" , result.message);
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/DINGA";
});
}
}
});
}
},100);
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
$("#qr_code").val(code);
}
function update_sale(membership_id, customer_id, customer_name, sale_id) {
var customer="";
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
swal({
title: "Confirmation !",
text: 'Are You Sure to assign this customer' + customer + '!',
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false,
}, function () {
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
//change customer detail
$("#customer_name").html(customer_name);
$("#membership_id").html(membership_id);
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
swal("Alert!", "Record not found!", "error");
location.reload();
}
}
});
});
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script> </script>

View File

@@ -140,9 +140,7 @@
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
var webview = <%= @webview %>; var webview = <%= @webview %>;
if(webview){
code2lab.checkMobile(webview); //js func: for mobile login
}
showHideNavbar(webview,"index"); showHideNavbar(webview,"index");
$(".tables").on('click', function(){ $(".tables").on('click', function(){

View File

@@ -0,0 +1,471 @@
<div class="container-fluid">
<div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important ">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item active" data-color="#F44336" style="background-color: #F44336;">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">4</p> <%= t :pending %></a>
</li>
<li class="nav-item" data-color="#673AB7" style="background-color: #673AB7;">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">4</p> <%= t :processing %></a>
</li>
<li class="nav-item" data-color="#009688" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">4</p> <%= t :delivering %></a>
</li>
<li class="nav-item" data-color="#03A9F4" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a>
</li>
</ul>
<div class="tab-content m-t--10">
<div class="tab-pane active" id="pending" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
4
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="processing" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="delivery" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
2
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="completed" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<tr>
<td width ="5%" class="align-left">
1
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
<tr>
<td width ="5%" class="align-left">
3
</td>
<td width ="30%" class="align-center">
3:30 PM
</td>
<td width ="30%" class="align-center">
13000
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">STATUS</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px -5px !important ">
<div class="card">
<div class="card-header custom-card-header" style="color:">
<table class="table">
<tr>
<td width ="70%" class="header-td align-left"><b class="col-pink font-16">No.11</b>
<span class="font-13">(DELIVERY)</span>
</td>
<td width ="30%" class="header-td font-16 align-right"><b>0065 4321</b></td>
</tr>
</table>
</div>
<div class="card-block custom-card-block">
<div id="order-detail-slimscroll" data-height="220">
<table class="table">
<tbody>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="body-td align-left">
MENU ITEM 01
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card-footer custom-card-footer">
<table class="table">
<tbody>
<tr>
<td width ="70%" class="footer-td align-left">
SUB TOTAL
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
DELIVERY FEES (PICK-UP)
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
CONVENIENCE CHARGES
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
</tr>
<tr>
<td width ="70%" class="footer-td align-left">
GOVERNMENT TAX
</td>
<td width ="30%" class="footer-td align-right">1400.00</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer grand-card-footer">
<table class="table">
<tbody>
<tr>
<td width ="70%" class="footer-td align-left col-blue">
GRAND TOTAL
</td>
<td width ="30%" class="footer-td align-right col-blue">1400.00</td>
</tr>
<tr>
<td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>DECLINE</strong></button>
</td>
<td width ="50%" class="footer-td align-right col-blue">
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>ACCEPT</strong></button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="'col-lg-4 col-md-4 col-sm-4'" style="margin:0px -5px 0px -2px !important ">
<div class="card" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td>
</tr>
</table>
</div>
<div class="card-block">
<table class="table">
<tbody>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b>DAW AYE AYE</b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b>09 8765 4321 098</b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">ADDRESS</span><br>
<b>No. (12), 3rd floor, zay kyee Street, kyi myin dine
infront of Nya Zay Main Entrance</b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">DELEVER TO</span><br>
<b>HOME</b>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<style type="text/css">
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
border-bottom: 2px solid #2196F3 ;
bottom: 2px ;
}
.nav-tabs .nav-link {
padding: 0.5286em .33em;
}
.nav-tabs li a.active {
color: #111 !important;
border-bottom: 0px solid #fff !important;
}
.nav-tabs .nav-link.active {
color: #111;
border-color: #fff;
}
.nav-tabs > li > a {
margin-right: 0px;
color:#fff !important;
}
.nav-tabs > li > a {
border-bottom: 2px solid #2196F3;
bottom: 2px;
}
.nav-tabs.tab-col-teal > li > a:before {
border-bottom: 0px solid #009688;
}
.nav-tabs .nav-item{
margin-bottom: 2px ;
}
.num{
color:#fff;
text-align: center;
margin-bottom: -1px !important;
}
.nav-tabs .nav-link.active > p{
color: #111;
border-color: #fff;
}
/*Custosm Class*/
.table .header-td{
border-top:0px solid !important;
border-bottom: 0px solid !important;
padding:3px 7px !important;
border-top:0px solid !important;
border-bottom: 0px solid !important;
}
.custom-card-block .table td:first-child,
.custom-card-block .table td:nth-child(2),
.custom-card-footer .table td:first-child,
.custom-card-footer .table td:nth-child(2){
border-top:0px solid !important;
}
.custom-card-footer .footer-td ,
.grand-card-footer .footer-td {
border-top:0px solid !important;
border-bottom:0px solid !important;
font-weight: bold;
padding:5px 10px;
}
.custom-card-header{
border-bottom: 1px solid #F8BBD0 !important;
padding:13px 5px !important;
}
.custom-card-footer{
border-top: 1px solid #F8BBD0 !important;
}
.custom-card-block,
.grand-card-footer,
.custom-card-footer{
padding :5px !important;
}
.custom-table{
background-color:#F3E5F5;
}
.custom-table tbody tr td,
.custom-table tbody tr th{
border-top: 1px solid #FFEBEE;
border-bottom: 1px solid #FFEBEE;
}
</style>

View File

@@ -13,6 +13,7 @@
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card m-l-10 m-t-10" style="padding:0px 20px;"> <div class="card m-l-10 m-t-10" style="padding:0px 20px;">
<div class="rebate-form"> <div class="rebate-form">
<input type="hidden" name="receipt_no" id="receipt_no" value="<%= @receipt_no%>">
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="">You can pay up to </label> <label class="">You can pay up to </label>
@@ -106,6 +107,33 @@
</div> </div>
</div> </div>
</div> </div>
<!-- customer light box -->
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
var cashier_type = "<%= @cashier_type %>"; var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() { $(document).ready(function() {
@@ -165,6 +193,7 @@
sale_id = $("#valid_amount").attr('data-value'); sale_id = $("#valid_amount").attr('data-value');
membership_id = $("#valid_amount").attr('data-member-value'); membership_id = $("#valid_amount").attr('data-member-value');
payment_amount = parseFloat($("#used_amount").text()); payment_amount = parseFloat($("#used_amount").text());
if((membership_id!=undefined) && (membership_id!="") && (membership_id > 0)){
if(payment_amount<=0 ){ if(payment_amount<=0 ){
swal ( "Oops" , "Please type valid amount!" , "warning" ); swal ( "Oops" , "Please type valid amount!" , "warning" );
}else if(valid_amount< payment_amount){ }else if(valid_amount< payment_amount){
@@ -175,7 +204,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paymal_path%>", url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id}, data: {payment_amount:payment_amount,membership_id:membership_id,sale_id:sale_id,transaction_ref:""},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){
swal({ swal({
@@ -198,5 +227,159 @@
swal ( "Oops" , "Payment Amount is over!" , "warning" ); swal ( "Oops" , "Payment Amount is over!" , "warning" );
} }
} }
}else{
$("#is_paymemberModal").modal({show : true, backdrop: false, keyboard : false});
}
});
// Read Card Reader
$(".btn_member").on('click', function(){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || "";
var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#used_amount").text());
$("#is_paymemberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount));
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Information" , result.message);
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
});
}
}
});
}
},100);
});
// Read NFC card no from java
function getCardNo(){
code2lab.readNFC();
}
// get CardNo from Java
function setCardNo(cardNo){
if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo);
}
}
// QR Code Reader
$(".btn_qr_code").on('click', function(e){
$("#is_paymemberModal").hide();
var code = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = $("#receipt_no").val() || "";
var payment_amount = parseFloat($("#used_amount").text());
setTimeout(function(){
code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
$("#valid_amount").val(parseFloat(valid_amount));
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal ( "Information" , result.message);
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment/others_payment/PAYMAL";
});
}
}
});
}
},100);
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
$("#qr_code").val(code);
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
}); });
</script> </script>

View File

@@ -1133,15 +1133,39 @@ var customer_name = "<%= @customer.name %>";
$(".btn_qr_code").on('click', function(e){ $(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide(); $("#is_memberModal").hide();
var code = ""; var code = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
setTimeout(function(){ setTimeout(function(){
code=getQRCode(); code=getQRCode();
$("#qr_code").val(code); if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : code ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
membership_id = data[0].membership_id;
membership_type = data[0].membership_type;
update_sale(membership_id, customer_id, customer_name,sale_id);
}
}
});
}
},100); },100);
}); });
// Read qrcode from java // Read qrcode from java
function getQRCode(){ function getQRCode(){
return code2lab.readQRCode(); return code2lab.readQRCode();
$("#qr_code").val(code);
} }
function update_sale(membership_id, customer_id, customer_name, sale_id) { function update_sale(membership_id, customer_id, customer_name, sale_id) {

View File

@@ -202,13 +202,13 @@ $(document).ready(function(){
// Bill Request // Bill Request
$('#request_bills').click(function () { $('#request_bills').click(function () {
var order_id = $('#save_order_id').val(); var order_id = $('#save_order_id').val();
var ajax_url = "/origami/" + order_id + "/request_bills"; var ajax_url = "../../../origami/" +order_id+ "/request_bills";
console.log(ajax_url)
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: ajax_url, url: ajax_url,
// data: 'order_id='+ order_id, // data: 'order_id='+ order_id,
success: function (result) { success: function (result) {
console.log(result)
if (!result.status) { if (!result.status) {
swal("Information!", result.error_message); swal("Information!", result.error_message);
} }

View File

@@ -107,7 +107,7 @@
<%end%> <%end%>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td> <td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> <td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
</tr> </tr>
@@ -120,7 +120,7 @@
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td> <td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %> <% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td> <td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td> <td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td> <td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
</tr> </tr>
<tr> <tr>

View File

@@ -62,7 +62,7 @@
<!-- <td><%= settings_menu.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td> --> <!-- <td><%= settings_menu.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td> -->
<td> <td>
<%= link_to t("views.btn.edit"), edit_settings_menu_path(settings_menu),:class => 'btn btn-info btn-sm waves-effect' %> <%= link_to t("views.btn.edit"), edit_settings_menu_path(settings_menu),:class => 'btn btn-info btn-sm waves-effect' %>
<a href="#" id="export-xlsx" data-attr="<%= settings_menu.id %>" class="btn btn-primary btn-sm waves-effect" style="height: 33px;"> <a href="#" id="export-xlsx" data-attr="<%= settings_menu.id %>" class="export-xlsx btn btn-primary btn-sm waves-effect" style="height: 33px;">
<i class="material-icons" style="top: 0px;">backup</i> <i class="material-icons" style="top: 0px;">backup</i>
</a> </a>
</td> </td>
@@ -107,9 +107,9 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("#export-xlsx").on('click', function(){ $(".export-xlsx").on('click', function(){
var menu_id= $(this).attr('data-attr'); var menu_id= $(this).attr('data-attr');
console.log(menu_id);
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "/settings/menus/" + menu_id + "/export", url: "/settings/menus/" + menu_id + "/export",

View File

@@ -3,6 +3,8 @@ require_relative 'boot'
require 'csv' require 'csv'
require 'rails/all' require 'rails/all'
# require 'iconv' # require 'iconv'
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.

View File

@@ -1,15 +0,0 @@
iv_key: rwOZKWcQho6fE4V+A2zFuQ==
shop_name: AMZ_Test
email: aungmyo.zaw@code2lab.com
telephone:
fax:
address:
dbhost: dNzh66R80remB694OEds96OpuyZ4wmHeHFdQh0KwjYFvTInK6+pCN/y6HdbyIlqqjcBHkqPjkjzw45PznLn7hA==
dbschema: 4vooJDxgWdFv/8V7Qx8tzR/8B8T2c5U4XvYcF+2KOoA=
dbusername: Xc8ELRsW7N/f8KsVikMBlg==
dbpassword: HMg+TbLxmfYrDFI4IIAd4g==
api_token: bisryXiEnbTJlZwghAnIByQpiRUMouu
app_token: LycQXJYBZGeCygjIEKdlBXnjIGMiMzgmt
plan_sku: 84hdnSCgkfhvItY7uB/pPQ==
renewable_date: 8E6Ecz8QXAMSlKZnIzn0pQ==
plan_name: 4cMIO0n/JzGFPIccXM6u5A==

View File

@@ -74,6 +74,7 @@ en:
date_time: "DateTime" date_time: "DateTime"
dine_in_cashier: "Dine-in Cashier" dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service" quick_service: "Quick Service"
order_reservation: "Order & Reservation"
views: views:
btn: btn:

View File

@@ -69,6 +69,7 @@ mm:
date_time: "ရက်စွဲအချိန်" date_time: "ရက်စွဲအချိန်"
dine_in_cashier: "Dine-in Cashier" dine_in_cashier: "Dine-in Cashier"
quick_service: "Quick Service" quick_service: "Quick Service"
order_reservation: "Order & Reservation"
views: views:
btn: btn:

View File

@@ -1,6 +1,7 @@
application_path = '/home/superuser/Application/sxrestaurant' application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path directory application_path
environment ENV.fetch("RAILS_ENV") { "production" } #environment ENV.fetch("RAILS_ENV") { "production" }
environment "production"
pidfile "#{application_path}/tmp/puma/pid" pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state" state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"

View File

@@ -82,7 +82,11 @@ scope "(:locale)", locale: /en|mm/ do
post "survey/:id" => "survey#create" post "survey/:id" => "survey#create"
end end
#order and reservation api
namespace :order_reserve do
post "customer" => "order_reservation#check_customer"
post "order" => "order_reservation#create"
end
end end
#--------- Cashier ------------# #--------- Cashier ------------#
@@ -218,6 +222,7 @@ scope "(:locale)", locale: /en|mm/ do
post '/:sale_id/:type/customers/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table post '/:sale_id/:type/customers/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
post '/:sale_id/get_customer' => "customers#get_customer" post '/:sale_id/get_customer' => "customers#get_customer"
post '/:sale_id/send_account' => "customers#send_account"
get '/:id/:type/surveys', to: "surveys#new" get '/:id/:type/surveys', to: "surveys#new"
match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put] match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put]
@@ -259,6 +264,8 @@ scope "(:locale)", locale: /en|mm/ do
post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' } post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' }
#order and reservation
resources :order_reservation
end end
#--------- Waiter/Ordering Station ------------# #--------- Waiter/Ordering Station ------------#

View File

@@ -12,8 +12,8 @@
development: development:
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61 secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api sx_provision_url: https://connect.pos-myanmar.com/bensai/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: application server_mode: cloud
cipher_type: AES-256-CBC cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L sx_key: Wh@t1$C2L

View File

@@ -1,7 +1,11 @@
{ {
"data": [ "data": [
{ {
"lookup": "local",
"value": {
"key": "999d675168d813d5e1c7",
"iv": "999d675168d813d5e1c7"
}
} }
] ]
} }

View File

@@ -21,7 +21,7 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
t.integer :dining_count, :default => 0 t.integer :dining_count, :default => 0
t.integer :takeaway_count, :default => 0 t.integer :takeaway_count, :default => 0
t.integer :member_count, :default => 0 t.integer :member_count, :default => 0
t.integer :total_rounding, :default => 0 t.decimal :total_rounding,, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.integer :total_receipt, :default => 0 t.integer :total_receipt, :default => 0
t.decimal :total_void, :default => 0 t.decimal :total_void, :default => 0
t.timestamps t.timestamps

View File

@@ -5,6 +5,8 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.string :order_reservation_type, :null => false t.string :order_reservation_type, :null => false
t.string :customer_id, :null => false t.string :customer_id, :null => false
t.datetime :requested_time, :null => false t.datetime :requested_time, :null => false
t.string :callback_url, :null => false
t.string :transaction_ref, :null => false
t.integer :item_count, :null => false, :default => 0 t.integer :item_count, :null => false, :default => 0
t.integer :total_customer t.integer :total_customer
t.string :payment_type t.string :payment_type
@@ -17,6 +19,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
t.string :status, :null => false, :default => "new" t.string :status, :null => false, :default => "new"
t.string :order_remark t.string :order_remark
t.string :reservation_remark t.string :reservation_remark
t.timestamps
end end
end end

View File

@@ -16,6 +16,7 @@ class CreateOrderReservationItems < ActiveRecord::Migration[5.1]
t.string :remark t.string :remark
t.string :options t.string :options
t.boolean :taxable, :null => false, :default => true t.boolean :taxable, :null => false, :default => true
t.timestamps
end end
end end

View File

@@ -9,6 +9,7 @@ class CreateDeliveries < ActiveRecord::Migration[5.1]
t.string :direction_address t.string :direction_address
t.string :delivery_fee t.string :delivery_fee
t.string :remark t.string :remark
t.timestamps
end end
end end

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
version: '3'
services:
code2lab:
build: .
links:
- redis
command: bundle exec puma -C config/puma.rb
volumes:
- .:/sxrestaurant
env_file:
- .code2lab.env
ports:
- '8081:62158'
environment:
- REDIS_URL=redis://redis:6379/0
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
links:
- redis
volumes:
- .:/sxrestaurant
environment:
- REDIS_URL=redis://redis:6379/0
redis:
image: redis
ports:
- '6379:6379'
volumes:
- ../data/redis:/data