Compare commits
18 Commits
2244c18b37
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98ac443182 | ||
|
|
d0a607e976 | ||
|
|
00369f96bd | ||
|
|
8171710421 | ||
|
|
8a7a17f3ce | ||
|
|
318443e918 | ||
|
|
942b8a54db | ||
|
|
eb1010d8af | ||
|
|
0ba20f45b3 | ||
|
|
cfa73532db | ||
|
|
ca6bb56fc3 | ||
|
|
904698180c | ||
|
|
d97bada5e6 | ||
|
|
d52bbd6de1 | ||
|
|
fc69dc2293 | ||
|
|
a603223f1c | ||
|
|
04e03896b9 | ||
|
|
f003900fee |
@@ -1,2 +1,7 @@
|
|||||||
.git
|
.git
|
||||||
.dockerignore
|
log/*
|
||||||
|
tmp/*
|
||||||
|
vendor/bundle
|
||||||
|
node_modules
|
||||||
|
.bundle
|
||||||
|
.DS_Store
|
||||||
|
|||||||
58
Dockerfile
58
Dockerfile
@@ -1,20 +1,38 @@
|
|||||||
FROM ruby:2.5
|
FROM ruby:2.6.10-slim-bullseye
|
||||||
RUN apt-get update -qq && apt-get install -y build-essential libmariadb-dev libcups2-dev libpq-dev nodejs tzdata
|
|
||||||
RUN mkdir /sxrestaurant
|
# Install dependencies (MySQL client + ImageMagick for CarrierWave/MiniMagick)
|
||||||
RUN mkdir -p /sxrestaurant/tmp/puma
|
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
|
||||||
ENV RAILS_ENV production
|
build-essential \
|
||||||
ENV RACK_ENV production
|
default-libmysqlclient-dev \
|
||||||
WORKDIR /sxrestaurant
|
nodejs \
|
||||||
#RUN gem install bundler
|
git \
|
||||||
#COPY Gemfile /sxrestaurant/Gemfile
|
curl \
|
||||||
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
imagemagick \
|
||||||
#RUN bundle install --without development test
|
libmagickwand-dev \
|
||||||
RUN echo "Asia/Rangoon" > /etc/timezone
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
|
||||||
RUN date
|
WORKDIR /app
|
||||||
COPY . /sxrestaurant
|
|
||||||
RUN gem install bundler
|
# Install correct bundler version (must match Gemfile.lock BUNDLED WITH)
|
||||||
#RUN bundle update --bundler
|
RUN gem install bundler:2.4.21
|
||||||
RUN bundle install --without development test
|
|
||||||
RUN bundle exec rake assets:precompile
|
# Install gems
|
||||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
COPY Gemfile Gemfile.lock ./
|
||||||
|
RUN bundle install --deployment --without development test --jobs 4
|
||||||
|
|
||||||
|
# Copy application
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Create required directories and runtime files
|
||||||
|
RUN mkdir -p tmp/pids tmp/puma tmp/cache tmp/sockets log storage public/uploads \
|
||||||
|
&& echo '{"data":[]}' > config/shops.json
|
||||||
|
|
||||||
|
# Precompile assets
|
||||||
|
RUN RAILS_ENV=production SECRET_KEY_BASE=placeholder bundle exec rake assets:precompile 2>/dev/null || true
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
|
CMD ["/app/entrypoint.sh"]
|
||||||
|
|||||||
4
Gemfile
4
Gemfile
@@ -1,6 +1,6 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
ruby '2.6.5'
|
ruby '~> 2.6.0'
|
||||||
#ruby '2.5.7'
|
#ruby '2.5.7'
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ gem 'mini_magick'
|
|||||||
gem 'jquery-fileupload-rails', '~> 0.4.7'
|
gem 'jquery-fileupload-rails', '~> 0.4.7'
|
||||||
|
|
||||||
#Report and Printing gems
|
#Report and Printing gems
|
||||||
gem 'cups', '~> 0.0.7'
|
# gem 'cups', '~> 0.0.7'
|
||||||
|
|
||||||
gem 'prawn'
|
gem 'prawn'
|
||||||
gem 'prawn-table'
|
gem 'prawn-table'
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ GEM
|
|||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
connection_pool (2.2.3)
|
connection_pool (2.2.3)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
cups (0.0.7)
|
|
||||||
database_cleaner (1.8.5)
|
database_cleaner (1.8.5)
|
||||||
diff-lcs (1.4.4)
|
diff-lcs (1.4.4)
|
||||||
erubi (1.9.0)
|
erubi (1.9.0)
|
||||||
@@ -360,7 +359,6 @@ DEPENDENCIES
|
|||||||
carrierwave (~> 1.0)
|
carrierwave (~> 1.0)
|
||||||
chartkick
|
chartkick
|
||||||
coffee-rails (~> 4.2)
|
coffee-rails (~> 4.2)
|
||||||
cups (~> 0.0.7)
|
|
||||||
database_cleaner
|
database_cleaner
|
||||||
factory_girl_rails (~> 4.0)
|
factory_girl_rails (~> 4.0)
|
||||||
faker
|
faker
|
||||||
|
|||||||
@@ -289,5 +289,27 @@ App.checkin = App.cable.subscriptions.create("SecondDisplayViewChannel", {
|
|||||||
jQuery("#s_reload").click();
|
jQuery("#s_reload").click();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status == "reload_and_update") {
|
||||||
|
$(".second_display_items tbody").empty();
|
||||||
|
console.log("data.data", data.data);
|
||||||
|
var items = items.items
|
||||||
|
for (var i in items) {
|
||||||
|
$(".second_display_items tbody").append(
|
||||||
|
`<tr>
|
||||||
|
<td>${parseInt(i) + 1}</td>
|
||||||
|
<td>${items[i].product_name}</td>
|
||||||
|
<td>${parseInt(items[i].qty)}</td>
|
||||||
|
<td>${items[i].price}</td>
|
||||||
|
</tr>
|
||||||
|
`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#s_sub_total").text(data.data.subtotal);
|
||||||
|
$("#s_tatal_tax").text(data.data.total_tax);
|
||||||
|
$("#s_total_discount").text(data.data.total_discount);
|
||||||
|
$("#s_grand_total").text(data.data.grand_total);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
|||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@trans_flag = true
|
@trans_flag = true
|
||||||
|
|
||||||
@cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court_qr"
|
@cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court"
|
||||||
Rails.logger.info "Precreate action called with params: #{@cashier_type}"
|
Rails.logger.info "Precreate action called with params: #{@cashier_type}"
|
||||||
|
|
||||||
# if params[:type] == "transaction"
|
# if params[:type] == "transaction"
|
||||||
@@ -35,6 +35,18 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
|||||||
@member_discount = MembershipSetting.find_by_discount(1)
|
@member_discount = MembershipSetting.find_by_discount(1)
|
||||||
@membership_rebate_balance=0
|
@membership_rebate_balance=0
|
||||||
|
|
||||||
|
@changable_tax = true
|
||||||
|
lookup_changable_tax = Lookup.collection_of('changable_tax')
|
||||||
|
if !lookup_changable_tax.empty?
|
||||||
|
lookup_changable_tax.each do |changable_tax|
|
||||||
|
if changable_tax[0].downcase == "change"
|
||||||
|
if changable_tax[1] == '0'
|
||||||
|
@changable_tax = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
begin
|
begin
|
||||||
@cash = 0.0
|
@cash = 0.0
|
||||||
@@ -421,6 +433,9 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
|||||||
def create
|
def create
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
Rails.logger.info("Processing payment for sale ID: #{sale_id}")
|
||||||
|
Rails.logger.info("#{params[:response_data]}")
|
||||||
|
|
||||||
unless current_login_employee
|
unless current_login_employee
|
||||||
render json: { status: false, message: "User not authenticated or employee context missing." }, status: :unauthorized
|
render json: { status: false, message: "User not authenticated or employee context missing." }, status: :unauthorized
|
||||||
return
|
return
|
||||||
@@ -434,10 +449,10 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
|||||||
PaymentGatewayAuditJob.perform_later({
|
PaymentGatewayAuditJob.perform_later({
|
||||||
receipt_no: Sale.find_by(sale_id: sale_id).receipt_no,
|
receipt_no: Sale.find_by(sale_id: sale_id).receipt_no,
|
||||||
gateway_name: "MMQR",
|
gateway_name: "MMQR",
|
||||||
endpoint_url: "",
|
endpoint_url: "Response from foodcourt server",
|
||||||
event_type: "kbz.payment.success",
|
event_type: "kbz.payment.success",
|
||||||
request_body: {},
|
request_body: {},
|
||||||
response_body: {},
|
response_body: params[:response_data].to_json,
|
||||||
request_method: nil,
|
request_method: nil,
|
||||||
shop_code: Shop.current_shop.shop_code
|
shop_code: Shop.current_shop.shop_code
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class License
|
|||||||
cache_license = nil
|
cache_license = nil
|
||||||
|
|
||||||
##Get redis connection from connection pool
|
##Get redis connection from connection pool
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
cache_license = redis.get(cache_key)
|
cache_license = redis.get(cache_key)
|
||||||
|
|
||||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||||
@@ -54,7 +54,7 @@ class License
|
|||||||
|
|
||||||
#Rails.logger.info "License - " + response.parsed_response.to_s
|
#Rails.logger.info "License - " + response.parsed_response.to_s
|
||||||
|
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
redis.set(cache_key, Marshal.dump(@license))
|
redis.set(cache_key, Marshal.dump(@license))
|
||||||
# redis.sadd("License:cache:keys", cache_key)
|
# redis.sadd("License:cache:keys", cache_key)
|
||||||
# Redis.current do |conn|
|
# Redis.current do |conn|
|
||||||
@@ -110,7 +110,7 @@ class License
|
|||||||
|
|
||||||
# if cache_license.nil?
|
# if cache_license.nil?
|
||||||
cache = {"shop" => @activate["shop_name"], "key" => aes_key, "iv" => @activate["iv_key"], "renewable_date" => @activate["renewable_date"] }
|
cache = {"shop" => @activate["shop_name"], "key" => aes_key, "iv" => @activate["iv_key"], "renewable_date" => @activate["renewable_date"] }
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
redis.set(cache_key, Marshal.dump(cache))
|
redis.set(cache_key, Marshal.dump(cache))
|
||||||
# end
|
# end
|
||||||
|
|
||||||
@@ -308,14 +308,14 @@ class License
|
|||||||
cache_license = nil
|
cache_license = nil
|
||||||
|
|
||||||
##Get redis connection from connection pool
|
##Get redis connection from connection pool
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
cache_license = redis.get(cache_key)
|
cache_license = redis.get(cache_key)
|
||||||
|
|
||||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||||
|
|
||||||
if cache_license.nil?
|
if cache_license.nil?
|
||||||
cache = {"shop" => shop_name, "key" => @data["secret_key"], "iv" => @data["iv_key"], "renewable_date" => @data["renewable_date"] }
|
cache = {"shop" => shop_name, "key" => @data["secret_key"], "iv" => @data["iv_key"], "renewable_date" => @data["renewable_date"] }
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
redis.set(cache_key, Marshal.dump(cache))
|
redis.set(cache_key, Marshal.dump(cache))
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@@ -332,7 +332,7 @@ class License
|
|||||||
cache_key = "shop:#{shop.chomp}"
|
cache_key = "shop:#{shop.chomp}"
|
||||||
|
|
||||||
##Get redis connection from connection pool
|
##Get redis connection from connection pool
|
||||||
redis = Redis.new
|
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||||
cache_shop = redis.get(cache_key)
|
cache_shop = redis.get(cache_key)
|
||||||
|
|
||||||
puts Marshal.load(cache_shop)
|
puts Marshal.load(cache_shop)
|
||||||
|
|||||||
@@ -751,6 +751,14 @@ class Sale < ApplicationRecord
|
|||||||
.where('(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ', 'completed', 'void', from, to)
|
.where('(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ', 'completed', 'void', from, to)
|
||||||
.group('sale_id')
|
.group('sale_id')
|
||||||
|
|
||||||
|
void_audits = SaleAudit.select(
|
||||||
|
"`sale_audits`.`sale_id`",
|
||||||
|
"`sale_audits`.`action`",
|
||||||
|
"MAX(`sale_audits`.`created_at`) as latest_audit"
|
||||||
|
)
|
||||||
|
.where(action: ['SALEVOID', 'CANCEL_MMQR_PAYMENT'])
|
||||||
|
.group("`sale_audits`.`sale_id`")
|
||||||
|
|
||||||
commercial_tax = ''
|
commercial_tax = ''
|
||||||
if tax_profiles.present?
|
if tax_profiles.present?
|
||||||
sale_taxes = sale_taxes.select(tax_profiles.map { |name| "SUM(case when (sale_taxes.tax_name = '#{name}') then sale_taxes.tax_payable_amount else 0 end) as `#{name.parameterize}`"}.join(', '))
|
sale_taxes = sale_taxes.select(tax_profiles.map { |name| "SUM(case when (sale_taxes.tax_name = '#{name}') then sale_taxes.tax_payable_amount else 0 end) as `#{name.parameterize}`"}.join(', '))
|
||||||
@@ -765,8 +773,8 @@ class Sale < ApplicationRecord
|
|||||||
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
|
IFNULL(SUM(case when (sale_status='completed') then old_grand_total else 0 end),0) as old_grand_total,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
|
IFNULL(SUM(case when (sale_status='completed') then amount_changed else 0 end),0) as total_change_amount,
|
||||||
IFNULL(SUM(case when (sale_status='void' AND sa_salevoid.sale_audit_id IS NOT NULL) then grand_total else 0 end),0) as void_amount,
|
IFNULL(SUM(CASE WHEN sale_status = 'void' AND void_audits.action = 'SALEVOID' THEN grand_total ELSE 0 END),0) as void_amount,
|
||||||
IFNULL(SUM(case when (sale_status='void' AND sa_mmqr.sale_audit_id IS NOT NULL) then grand_total else 0 end),0) as mmqr_cancelled_void_amount,
|
IFNULL(SUM(CASE WHEN sale_status = 'void' AND void_audits.action = 'CANCEL_MMQR_PAYMENT' THEN grand_total ELSE 0 END),0) as mmqr_cancelled_void_amount,
|
||||||
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
|
IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj,
|
||||||
#{tax_profiles.map { |name| "IFNULL(SUM(case when (sale_status='completed') then `#{name.parameterize}` else 0 end),0) as `#{name.parameterize}`"}.push('').join(', ') if tax_profiles.present?}
|
#{tax_profiles.map { |name| "IFNULL(SUM(case when (sale_status='completed') then `#{name.parameterize}` else 0 end),0) as `#{name.parameterize}`"}.push('').join(', ') if tax_profiles.present?}
|
||||||
IFNULL(SUM(case when (sale_status='completed') then total_tax else 0 end),0) as tax,
|
IFNULL(SUM(case when (sale_status='completed') then total_tax else 0 end),0) as tax,
|
||||||
@@ -785,8 +793,7 @@ class Sale < ApplicationRecord
|
|||||||
#{sales.to_sql}
|
#{sales.to_sql}
|
||||||
) as s
|
) as s
|
||||||
LEFT JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id
|
LEFT JOIN (#{sale_taxes.to_sql}) AS st ON s.sale_id = st.sale_id
|
||||||
LEFT JOIN sale_audits sa_salevoid ON s.sale_id = sa_salevoid.sale_id AND sa_salevoid.action = 'SALEVOID'
|
LEFT JOIN (#{void_audits.to_sql}) AS `void_audits` ON `void_audits`.`sale_id` = `s`.`sale_id`
|
||||||
LEFT JOIN sale_audits sa_mmqr ON s.sale_id = sa_mmqr.sale_id AND sa_mmqr.action = 'CANCEL_MMQR_PAYMENT'
|
|
||||||
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
|
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
|
||||||
return daily_total
|
return daily_total
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class SalePayment < ApplicationRecord
|
|||||||
amount_due = invoice.sale_payments
|
amount_due = invoice.sale_payments
|
||||||
.map(&:payment_amount).reduce(invoice.grand_total, :-)
|
.map(&:payment_amount).reduce(invoice.grand_total, :-)
|
||||||
end
|
end
|
||||||
|
# byebug
|
||||||
if amount_due > 0
|
if amount_due > 0
|
||||||
payment_status = false
|
payment_status = false
|
||||||
membership_data = nil
|
membership_data = nil
|
||||||
@@ -169,11 +169,20 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
sale_update_payment_status(0)
|
sale_update_payment_status(0)
|
||||||
|
|
||||||
|
membership_data = nil
|
||||||
|
#route to payment type
|
||||||
|
case payment_method
|
||||||
|
when "foc"
|
||||||
|
payment_status = foc_payment
|
||||||
|
when "paymal"
|
||||||
|
payment_status, membership_data = paymal_payment
|
||||||
|
end
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
|
||||||
|
|
||||||
return false, "No outstanding Amount"
|
return false, "No outstanding Amount", membership_data
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -121,39 +121,47 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
# Add order items under order info
|
# Add order items under order info
|
||||||
def add_order_items(order_item, alt_name, precision)
|
def add_order_items(order_item, alt_name, precision)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
order = order_item.first.order
|
||||||
|
sale_orders = order.sale_orders
|
||||||
|
sale = Sale.find_by(sale_id: sale_orders.first.sale_id)
|
||||||
|
sale_items = sale.sale_items.order(:product_name)
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
order_item.each do|odi|
|
sale_items.each do|sale_item|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
# if odi.price != 0
|
# if odi.price != 0
|
||||||
|
if sale_item.status == 'foc' || sale_item.status == 'Discount'
|
||||||
|
next
|
||||||
|
end
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{sale_item.product_code} - #{sale_item.product_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
text "#{number_format(sale_item.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{sale_item.product_code} - #{sale_item.product_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if alt_name
|
if alt_name
|
||||||
if !(odi.alt_name).empty?
|
if !(sale_item.alt_name).empty?
|
||||||
move_down 4
|
move_down 4
|
||||||
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
text "(#{sale_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
|
odi = OrderItem.where(item_instance_code: sale_item.item_instance_code).first
|
||||||
options = odi.options == "[]"? "" : odi.options
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
if options != ""
|
if options != ""
|
||||||
@@ -174,6 +182,57 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# order_item.each do|odi|
|
||||||
|
# # check for item not to show
|
||||||
|
# # if odi.price != 0
|
||||||
|
# y_position = cursor
|
||||||
|
|
||||||
|
# bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
# text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
|
# bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
|
# text "#{number_format(odi.qty, :precision => precision.to_i)}", :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
|
||||||
|
# bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
# text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
|
# if alt_name
|
||||||
|
# if !(odi.alt_name).empty?
|
||||||
|
# move_down 4
|
||||||
|
# # font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||||
|
# text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
# # end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
|
# # add option
|
||||||
|
# options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
|
# if options != ""
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
# y_position = cursor
|
||||||
|
# bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
# text "#{options}", :size => self.item_font_size,:align => :left
|
||||||
|
# end
|
||||||
|
|
||||||
|
# move_down 5
|
||||||
|
# end
|
||||||
|
|
||||||
|
# move_down 5
|
||||||
|
|
||||||
|
# dash(1, :space => 1, :phase => 1)
|
||||||
|
# stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
|
# move_down 5
|
||||||
|
# # end
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_booking_id(order_no)
|
def get_booking_id(order_no)
|
||||||
|
|||||||
@@ -263,6 +263,10 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if item.qty < 0 && item.status == 'void'
|
||||||
|
total_qty += item.qty
|
||||||
|
end
|
||||||
|
|
||||||
product_name = item.product_name
|
product_name = item.product_name
|
||||||
|
|
||||||
# if item.status = 'promotion' && (item.remark =='promotion nett price' || item.remark == 'promotion discount')
|
# if item.status = 'promotion' && (item.remark =='promotion nett price' || item.remark == 'promotion discount')
|
||||||
|
|||||||
@@ -56,6 +56,16 @@ class KbzMerchant
|
|||||||
api_url = "#{@url}/queryorder"
|
api_url = "#{@url}/queryorder"
|
||||||
payload = build_query_payload(merch_order_id)
|
payload = build_query_payload(merch_order_id)
|
||||||
response = send_request(payload, api_url)
|
response = send_request(payload, api_url)
|
||||||
|
PaymentGatewayAuditJob.perform_later({
|
||||||
|
receipt_no: merch_order_id,
|
||||||
|
gateway_name: "MMQR",
|
||||||
|
endpoint_url: api_url,
|
||||||
|
event_type: "kbz.payment.queryorder",
|
||||||
|
request_body: payload,
|
||||||
|
response_body: response,
|
||||||
|
request_method: "POST",
|
||||||
|
shop_code: Shop.current_shop.shop_code
|
||||||
|
})
|
||||||
handle_response(response)
|
handle_response(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% @sale_data.sale_items.includes(:discount_item).each do |sale_item| %>
|
<% @sale_data.sale_items.includes(:discount_item).each do |sale_item| %>
|
||||||
<% sub_total += sale_item.qty * sale_item.unit_price %>
|
<% sub_total += sale_item.status == "Discount"? sale_item.price : sale_item.qty * sale_item.unit_price %>
|
||||||
<% if sale_item.price > 0 && sale_item.status.blank? %>
|
<% if sale_item.price > 0 && sale_item.status.blank? %>
|
||||||
<tr class="item-row item" id="<%= sale_item.sale_item_id %>"
|
<tr class="item-row item" id="<%= sale_item.sale_item_id %>"
|
||||||
data-account-type="<%=sale_item.account_id%>"
|
data-account-type="<%=sale_item.account_id%>"
|
||||||
@@ -271,6 +271,8 @@
|
|||||||
var precision = <%= precision %>;
|
var precision = <%= precision %>;
|
||||||
var originalAmount = totalAmount;
|
var originalAmount = totalAmount;
|
||||||
var originalDiscount = totalDiscount;
|
var originalDiscount = totalDiscount;
|
||||||
|
var queryParams = new URLSearchParams(window.location.search)
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||||
/* check webview loaded*/
|
/* check webview loaded*/
|
||||||
@@ -281,17 +283,10 @@
|
|||||||
var id = $("#table_id").text();
|
var id = $("#table_id").text();
|
||||||
var type = $("#table_type").text();
|
var type = $("#table_type").text();
|
||||||
var sale_id = $('#sale-id').text();
|
var sale_id = $('#sale-id').text();
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
} else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
} else if (cashier_type == 'food_court_qr') {
|
|
||||||
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (type=="Table") {
|
|
||||||
window.location.href = '/foodcourt/table/'+id
|
|
||||||
}else{
|
|
||||||
window.location.href = '/foodcourt/room/'+id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -488,12 +483,7 @@
|
|||||||
var sub_total = totalAmount;
|
var sub_total = totalAmount;
|
||||||
var ajax_url = "/foodcourt/" + sale_id + "/discount";
|
var ajax_url = "/foodcourt/" + sale_id + "/discount";
|
||||||
|
|
||||||
if (cashier_type == "food_court_qr") {
|
|
||||||
var c_type = "food_court";
|
|
||||||
var params = { 'cashier_type' : c_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
|
||||||
}else{
|
|
||||||
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@@ -505,18 +495,11 @@
|
|||||||
title: "Information!",
|
title: "Information!",
|
||||||
text: result.status,
|
text: result.status,
|
||||||
}, function () {
|
}, function () {
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
}
|
||||||
|
else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}else if(cashier_type == "food_court_qr") {
|
|
||||||
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(result.table_type == "Table"){
|
|
||||||
window.location.href = "/foodcourt/table/" + result.table_id
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.location.href = "/foodcourt/room/" + result.table_id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -554,15 +537,11 @@
|
|||||||
text: result.status,
|
text: result.status,
|
||||||
type: "success",
|
type: "success",
|
||||||
}, function () {
|
}, function () {
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
}
|
||||||
|
else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}else{
|
|
||||||
if(result.table_type == "Table"){
|
|
||||||
window.location.href = "/foodcourt/table/" + result.table_id
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.location.href = "/foodcourt/room/" + result.table_id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -581,15 +560,11 @@
|
|||||||
text: result.status,
|
text: result.status,
|
||||||
type: "success",
|
type: "success",
|
||||||
}, function () {
|
}, function () {
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
}
|
||||||
|
else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}else{
|
|
||||||
if(result.table_type == "Table"){
|
|
||||||
window.location.href = "/foodcourt/table/" + result.table_id
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.location.href = "/foodcourt/room/" + result.table_id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% @sale_data.sale_items.each do |sale_item| %>
|
<% @sale_data.sale_items.each do |sale_item| %>
|
||||||
<%
|
<%
|
||||||
sub_total += sale_item.qty*sale_item.unit_price
|
sub_total += sale_item.status == "Discount" ? sale_item.price : sale_item.qty*sale_item.unit_price
|
||||||
unless sale_item.price == 0
|
unless sale_item.price == 0
|
||||||
%>
|
%>
|
||||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||||
@@ -200,7 +200,7 @@
|
|||||||
<%if !@table.nil?%>
|
<%if !@table.nil?%>
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" onclick="window.location.href='/foodcourt/<%=@table.type.downcase%>/<%=@table.id%>'" id="back"><i class="material-icons">reply</i> Back</button>
|
<button type="button" class="btn btn-block btn-default waves-effect" onclick="window.location.href='/foodcourt/<%=@table.type.downcase%>/<%=@table.id%>'" id="back"><i class="material-icons">reply</i> Back</button>
|
||||||
<%else%>
|
<%else%>
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" onclick="window.location.href='/foodcourt/sale/<%=@sale_data.sale_id%>/<%=@cashier_type%>/payment'" id="back"><i class="material-icons">reply</i> Back</button>
|
<button type="button" class="btn btn-block btn-default waves-effect" id="back"><i class="material-icons">reply</i> Back</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>Refresh</button>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>Refresh</button>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -210,6 +210,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var queryParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
function otherCharges(val){
|
function otherCharges(val){
|
||||||
var aa = parseInt(val);
|
var aa = parseInt(val);
|
||||||
@@ -273,6 +274,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#back').on('click', function() {
|
||||||
|
window.location.href = '/foodcourt/<%= @sale_data.sale_id %>/qrpay/precreate';
|
||||||
|
});
|
||||||
|
|
||||||
// Remove selected discount items
|
// Remove selected discount items
|
||||||
$("#remove-item").on('click', function(e){
|
$("#remove-item").on('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -336,19 +341,11 @@
|
|||||||
text: "Success",
|
text: "Success",
|
||||||
type:"success"
|
type:"success"
|
||||||
}, function () {
|
}, function () {
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
} else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
} else if (cashier_type == "food_court_qr") {
|
|
||||||
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
|
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
if(result.table_type == "Table"){
|
|
||||||
window.location.href = "/foodcourt/table/" + result.table_id
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
window.location.href = "/foodcourt/room/" + result.table_id
|
|
||||||
}
|
|
||||||
}s
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -212,9 +212,11 @@
|
|||||||
<% if @sale_payment.nil? %>
|
<% if @sale_payment.nil? %>
|
||||||
<hr>
|
<hr>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<% if current_login_employee.role == "cashier" %>
|
||||||
|
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> Foc</a>
|
||||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> > Foc </button>
|
||||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -407,6 +409,17 @@
|
|||||||
<%= render "layouts/read_modal" %>
|
<%= render "layouts/read_modal" %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$.post('/foodcourt/customer_view', {
|
||||||
|
data: {
|
||||||
|
items: <%= raw @sale_data.sale_items.to_json %>,
|
||||||
|
subtotal: <%= number_with_precision(@sale_data.total_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
total_discount: <%= number_with_precision(@sale_data.total_discount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
total_tax: <%= number_with_precision(@sale_data.total_tax, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
grand_total: <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
},
|
||||||
|
status: "reload_and_update"
|
||||||
|
}, function(result) {}, 'json');
|
||||||
|
|
||||||
// //control borwser back
|
// //control borwser back
|
||||||
window.location.hash="no-back-button";
|
window.location.hash="no-back-button";
|
||||||
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
|
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
|
||||||
|
|||||||
@@ -326,6 +326,8 @@ $(document).ready(function() {
|
|||||||
let fallbackTimeout;
|
let fallbackTimeout;
|
||||||
let connected = false;
|
let connected = false;
|
||||||
|
|
||||||
|
let fc_server_response;
|
||||||
|
|
||||||
function handlePaymentSuccess() {
|
function handlePaymentSuccess() {
|
||||||
if (paymentProcessed) return;
|
if (paymentProcessed) return;
|
||||||
paymentProcessed = true;
|
paymentProcessed = true;
|
||||||
@@ -347,7 +349,7 @@ $(document).ready(function() {
|
|||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
|
||||||
},
|
},
|
||||||
data: JSON.stringify({ sale_id: "<%= @sale_data.sale_id %>" }),
|
data: JSON.stringify({ sale_id: "<%= @sale_data.sale_id %>", response_data: fc_server_response }),
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
customer_display_view({
|
customer_display_view({
|
||||||
@@ -411,6 +413,7 @@ $(document).ready(function() {
|
|||||||
received(data) {
|
received(data) {
|
||||||
console.log("Received:", data);
|
console.log("Received:", data);
|
||||||
if (data.status === "PAY_SUCCESS" && !paymentProcessed) {
|
if (data.status === "PAY_SUCCESS" && !paymentProcessed) {
|
||||||
|
fc_server_response = data
|
||||||
clearTimeout(fallbackTimeout);
|
clearTimeout(fallbackTimeout);
|
||||||
handlePaymentSuccess();
|
handlePaymentSuccess();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,9 +259,11 @@
|
|||||||
<% if @sale_payment.nil? %>
|
<% if @sale_payment.nil? %>
|
||||||
<hr>
|
<hr>
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<% if current_login_employee.role == "cashier" %>
|
||||||
|
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> Foc</a>
|
||||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> > Foc </button>
|
||||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -465,6 +467,19 @@ var paymalcount = <%= @paymalcount %>;
|
|||||||
var customer_paypar_account = '<%= @sale_data.customer.paypar_account_no %>';
|
var customer_paypar_account = '<%= @sale_data.customer.paypar_account_no %>';
|
||||||
// console.log(pdf_view)
|
// console.log(pdf_view)
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$.post('/foodcourt/customer_view', {
|
||||||
|
data: {
|
||||||
|
items: <%= raw @sale_data.sale_items.to_json %>,
|
||||||
|
subtotal: <%= number_with_precision(@sale_data.total_amount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
total_discount: <%= number_with_precision(@sale_data.total_discount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
total_tax: <%= number_with_precision(@sale_data.total_tax, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
grand_total: <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i) %>,
|
||||||
|
},
|
||||||
|
status: "reload_and_update"
|
||||||
|
}, function(result) {}, 'json');
|
||||||
|
|
||||||
|
|
||||||
$("#read_modal").modal('hide');
|
$("#read_modal").modal('hide');
|
||||||
/* replace url type*/
|
/* replace url type*/
|
||||||
if(!trans_flag){
|
if(!trans_flag){
|
||||||
@@ -557,7 +572,7 @@ $(document).ready(function(){
|
|||||||
var sale_id = $('#save_order_id').attr('data-order');
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
}
|
}
|
||||||
if (sale_id != "") {
|
if (sale_id != "") {
|
||||||
window.location.href = '/foodcourt/' + sale_id +"/"+cashier_type+ '/other_charges'
|
window.location.href = '/foodcourt/' + sale_id +"/"+cashier_type+ '/other_charges?payment_type=qr'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
@@ -575,7 +590,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sale_id != "") {
|
if (sale_id != "") {
|
||||||
window.location.href = '/foodcourt/' + sale_id + "/"+cashier_type+'/discount'
|
window.location.href = '/foodcourt/' + sale_id + "/"+cashier_type+'/discount?payment_type=qr'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
@@ -591,9 +606,9 @@ $(document).ready(function(){
|
|||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
if ($(this).attr('active')=== "true") {
|
if ($(this).attr('active')=== "true") {
|
||||||
if (dining_id) {
|
if (dining_id) {
|
||||||
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
|
||||||
}else{
|
}else{
|
||||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@@ -1010,7 +1025,7 @@ $(document).ready(function(){
|
|||||||
if (type == "edit") {
|
if (type == "edit") {
|
||||||
var dining_id = $('#dining').text();
|
var dining_id = $('#dining').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit?payment_type=qr";
|
||||||
}else if(type == "void"){
|
}else if(type == "void"){
|
||||||
$('#AccessCodeModal').modal('hide');
|
$('#AccessCodeModal').modal('hide');
|
||||||
$('#voidModal').modal('show');
|
$('#voidModal').modal('show');
|
||||||
@@ -1175,7 +1190,7 @@ $(document).ready(function(){
|
|||||||
if(data.status){
|
if(data.status){
|
||||||
// console.log(type);
|
// console.log(type);
|
||||||
localStorage.setItem("tax_type", type);
|
localStorage.setItem("tax_type", type);
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment';
|
window.location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -237,6 +237,8 @@
|
|||||||
<script>
|
<script>
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
var access_code = localStorage.getItem("access_code");
|
var access_code = localStorage.getItem("access_code");
|
||||||
|
var queryParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
@@ -370,15 +372,12 @@ var access_code = localStorage.getItem("access_code");
|
|||||||
$('#back').on('click', function () {
|
$('#back').on('click', function () {
|
||||||
var table_id = '<%= @table_id %>'
|
var table_id = '<%= @table_id %>'
|
||||||
var sale_id = "<%= @saleobj.sale_id %>"
|
var sale_id = "<%= @saleobj.sale_id %>"
|
||||||
if (cashier_type=="quick_service" || cashier_type == "food_court") {
|
|
||||||
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
} else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}
|
}
|
||||||
else if(cashier_type=="food_court_qr"){
|
|
||||||
window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
window.location.href = '/foodcourt/table/' + table_id;
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#cancel_all_void').on('click', function () {
|
$('#cancel_all_void').on('click', function () {
|
||||||
@@ -403,16 +402,11 @@ var access_code = localStorage.getItem("access_code");
|
|||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
if (cashier_type=="quick_service" || cashier_type=="food_court") {
|
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
|
||||||
|
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
|
||||||
|
} else if(cashier_type == "food_court") {
|
||||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||||
}
|
}
|
||||||
else if(cashier_type=="food_court_qr"){
|
|
||||||
window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
window.location.href = '/foodcourt/table/' + table_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<td class="text-right item-attr"><strong id="s_total_discount"></strong></td>
|
<td class="text-right item-attr"><strong id="s_total_discount"></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Tax Amount (5%):</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="text-right item-attr"><strong id="s_tatal_tax"></strong></td>
|
<td class="text-right item-attr"><strong id="s_tatal_tax"></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="table-active">
|
<tr class="table-active">
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
.new-design-navbar .navbar-brand:hover {
|
.new-design-navbar .navbar-brand:hover {
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
.new-design-navbar .navbar-brand img {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.new-design-navbar .navbar-brand .material-icons {
|
.new-design-navbar .navbar-brand .material-icons {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
@@ -145,25 +148,60 @@
|
|||||||
font-feature-settings: 'liga';
|
font-feature-settings: 'liga';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Responsive Styles */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.new-design-navbar .navbar-center-section {
|
||||||
|
/* display: none; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-design-navbar .navbar-right-section .connection-status-text,
|
||||||
|
.new-design-navbar .navbar-right-section .user-name-text {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-design-navbar .navbar-right-section .nav-item {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-design-navbar .navbar-brand {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-design-navbar .bars-toggle {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.new-design-navbar .navbar-brand-text {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.new-design-navbar .navbar-brand img {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<%# Top Bar - New Design %>
|
<%# Top Bar - New Design %>
|
||||||
<% if !request.path_info.include?('second_display') %>
|
<% if !request.path_info.include?('second_display') %>
|
||||||
<nav class="navbar new-design-navbar mb-1" style="position: sticky;">
|
<nav class="navbar new-design-navbar mb-1" style="position: sticky;">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="navbar-left-section">
|
<div class="navbar-left-section d-flex justify-content-between">
|
||||||
<% if current_login_employee.role != "waiter" %>
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<a href="javascript:void(0);" class="bars bars-toggle">
|
<a href="javascript:void(0);" class="bars bars-toggle">
|
||||||
<!-- <i class="material-icons">menu</i> -->
|
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%# Brand Name and Icon %>
|
<%# Brand Name and Icon %>
|
||||||
<a class="navbar-brand" href="<%= root_path %>">
|
<a class="navbar-brand" href="<%= root_path %>">
|
||||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||||
<span>SX Restaurant</span>
|
<%# <span class="navbar-brand-text">SX Restaurant</span> %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="navbar-center-section">
|
||||||
|
<%= Shop.current_shop.name %>
|
||||||
|
</div>
|
||||||
<div class="navbar-right-section">
|
<div class="navbar-right-section">
|
||||||
<%# Connection Status %>
|
<%# Connection Status %>
|
||||||
<div class="nav-item" id="connection-status-item">
|
<div class="nav-item" id="connection-status-item">
|
||||||
@@ -175,7 +213,7 @@
|
|||||||
<div class="nav-item dropdown">
|
<div class="nav-item dropdown">
|
||||||
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||||
<i class="material-icons">person</i>
|
<i class="material-icons">person</i>
|
||||||
<span><%= current_login_employee.name %></span>
|
<span class="user-name-text"><%= current_login_employee.name %></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<% if current_login_employee.role == "administrator" %>
|
<% if current_login_employee.role == "administrator" %>
|
||||||
|
|||||||
@@ -46,7 +46,10 @@
|
|||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
|
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
|
||||||
|
<% end %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<% if @tax_profiles.present? %>
|
<% if @tax_profiles.present? %>
|
||||||
@@ -101,7 +104,9 @@
|
|||||||
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
@@ -131,7 +136,9 @@
|
|||||||
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,10 @@
|
|||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
|
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.mmqr_void_amount") %></th>
|
||||||
|
<% end %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<% if @tax_profiles.present? %>
|
<% if @tax_profiles.present? %>
|
||||||
@@ -89,7 +92,10 @@
|
|||||||
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(sale[:mmqr_cancelled_void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
@@ -119,7 +125,9 @@
|
|||||||
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='color:red;text-align:right;'><%= number_format(mmqr_void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
||||||
</select>
|
</select>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
<% mmqr = PaymentMethodSetting.find_by(payment_method: 'MMQR') %>
|
||||||
|
<% if mmqr.present? && mmqr.is_active %>
|
||||||
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
|
<div class="form-group col-lg-3 col-md-3 col-sm-3 mbl-style">
|
||||||
<label class="font-20 mbl_lbl">Status</label>
|
<label class="font-20 mbl_lbl">Status</label>
|
||||||
<select class="form-control select" name="void_filter" id="void_filter" style="height: 37px;">
|
<select class="form-control select" name="void_filter" id="void_filter" style="height: 37px;">
|
||||||
@@ -41,6 +43,7 @@
|
|||||||
<option value="cancelled_mmqr" <%= 'selected' if params[:void_filter] == 'cancelled_mmqr' %>>Cancelled Payment (MMQR)</option>
|
<option value="cancelled_mmqr" <%= 'selected' if params[:void_filter] == 'cancelled_mmqr' %>>Cancelled Payment (MMQR)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
|
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
redis: &redis
|
redis: &redis
|
||||||
adapter: redis
|
adapter: redis
|
||||||
url: redis://localhost:6379/1
|
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>
|
||||||
|
|
||||||
production: *redis
|
production: *redis
|
||||||
development: *redis
|
development: *redis
|
||||||
|
|||||||
10
config/database.yml
Normal file
10
config/database.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
production:
|
||||||
|
adapter: mysql2
|
||||||
|
encoding: utf8mb4
|
||||||
|
pool: 25
|
||||||
|
host: <%= ENV.fetch('DATABASE_HOST', '54.151.188.42') %>
|
||||||
|
port: <%= ENV.fetch('DATABASE_PORT', '13306') %>
|
||||||
|
wait_timeout: 60
|
||||||
|
database: <%= ENV.fetch('DATABASE_NAME', 'foodcourt') %>
|
||||||
|
username: <%= ENV.fetch('DATABASE_USER', 'foodcourt') %>
|
||||||
|
password: <%= ENV.fetch('DATABASE_PASSWORD', 'foodcourt') %>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
config = YAML.load_file("#{Rails.root}/config/secrets.yml")
|
config = YAML.load(ERB.new(File.read("#{Rails.root}/config/secrets.yml")).result)
|
||||||
config.fetch(Rails.env, {}).each do |key, value|
|
config.fetch(Rails.env, {}).each do |key, value|
|
||||||
ENV[key.upcase] = value.to_s
|
ENV[key.upcase] ||= value.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
# SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
# SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
redis = YAML::load(File.open("#{ Rails.root }/config/redis.yml"))[::Rails.env]
|
redis = YAML::load(ERB.new(File.read("#{ Rails.root }/config/redis.yml")).result)[::Rails.env]
|
||||||
|
|
||||||
Sidekiq.configure_server do |config|
|
Sidekiq.configure_server do |config|
|
||||||
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
|
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ en:
|
|||||||
to_date: "To Date"
|
to_date: "To Date"
|
||||||
sr: "Sr"
|
sr: "Sr"
|
||||||
void_amount: "Void Amount"
|
void_amount: "Void Amount"
|
||||||
mmqr_void_amount: "MMQR Void Amount"
|
mmqr_void_amount: "MMQR Cancel Amount"
|
||||||
mpu_sales: "MPU Sales"
|
mpu_sales: "MPU Sales"
|
||||||
master_sales: "Master Sales"
|
master_sales: "Master Sales"
|
||||||
visa_sales: "Visa Sales"
|
visa_sales: "Visa Sales"
|
||||||
|
|||||||
17
config/puma_docker.rb
Normal file
17
config/puma_docker.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Puma configuration for Docker deployment
|
||||||
|
application_path = File.expand_path('..', __dir__)
|
||||||
|
directory application_path
|
||||||
|
|
||||||
|
environment ENV.fetch('RAILS_ENV') { 'production' }
|
||||||
|
pidfile "#{application_path}/tmp/puma/pid"
|
||||||
|
state_path "#{application_path}/tmp/puma/state"
|
||||||
|
|
||||||
|
# Log to stdout/stderr in Docker
|
||||||
|
stdout_redirect '/dev/stdout', '/dev/stderr', true
|
||||||
|
|
||||||
|
# Use PORT env var (default 3000 for Coolify)
|
||||||
|
port ENV.fetch('PORT') { 3000 }
|
||||||
|
|
||||||
|
workers ENV.fetch('WEB_CONCURRENCY') { 3 }
|
||||||
|
preload_app!
|
||||||
|
threads 5, 16
|
||||||
@@ -10,4 +10,4 @@ test:
|
|||||||
|
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
url: redis://127.0.0.1:6379
|
url: <%= ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379') %>
|
||||||
|
|||||||
@@ -1,18 +1,6 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# Your secret key is used for verifying the integrity of signed cookies.
|
|
||||||
# If you change this key, all old signed cookies will become invalid!
|
|
||||||
|
|
||||||
# Make sure the secret is at least 30 characters and all random,
|
|
||||||
# no regular words or you'll be exposed to dictionary attacks.
|
|
||||||
# You can use `rails secret` to generate a secure secret key.
|
|
||||||
|
|
||||||
# Make sure the secrets in this file are kept private
|
|
||||||
# if you're sharing your code publicly.
|
|
||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: connect.smartsales.asia/api
|
||||||
server_mode: application
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
@@ -20,11 +8,9 @@ development:
|
|||||||
test:
|
test:
|
||||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||||
|
|
||||||
# Do not keep production secrets in the repository,
|
|
||||||
# instead read values from the environment.
|
|
||||||
production:
|
production:
|
||||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
secret_key_base: <%= ENV.fetch('SECRET_KEY_BASE', 'c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22') %>
|
||||||
sx_provision_url: connect.smartsales.asia/api #l.doemal.app/api #52.221.188.144:9292/api #192.168.1.147:3002/api
|
sx_provision_url: <%= ENV.fetch('SX_PROVISION_URL', 'connect.smartsales.asia/api') %>
|
||||||
server_mode: application
|
server_mode: <%= ENV.fetch('SERVER_MODE', 'cloud') %>
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: <%= ENV.fetch('CIPHER_TYPE', 'AES-256-CBC') %>
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: <%= ENV.fetch('SX_KEY', 'Wh@t1$C2L') %>
|
||||||
|
|||||||
8
entrypoint.sh
Executable file
8
entrypoint.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Start Sidekiq in background
|
||||||
|
bundle exec sidekiq -C config/sidekiq.yml -e production &
|
||||||
|
|
||||||
|
# Start Puma on port 3000
|
||||||
|
exec bundle exec puma -C config/puma_docker.rb
|
||||||
Reference in New Issue
Block a user