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
|
||||
.dockerignore
|
||||
log/*
|
||||
tmp/*
|
||||
vendor/bundle
|
||||
node_modules
|
||||
.bundle
|
||||
.DS_Store
|
||||
|
||||
58
Dockerfile
58
Dockerfile
@@ -1,20 +1,38 @@
|
||||
FROM ruby:2.5
|
||||
RUN apt-get update -qq && apt-get install -y build-essential libmariadb-dev libcups2-dev libpq-dev nodejs tzdata
|
||||
RUN mkdir /sxrestaurant
|
||||
RUN mkdir -p /sxrestaurant/tmp/puma
|
||||
ENV RAILS_ENV production
|
||||
ENV RACK_ENV production
|
||||
WORKDIR /sxrestaurant
|
||||
#RUN gem install bundler
|
||||
#COPY Gemfile /sxrestaurant/Gemfile
|
||||
#COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
||||
#RUN bundle install --without development test
|
||||
RUN echo "Asia/Rangoon" > /etc/timezone
|
||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN date
|
||||
COPY . /sxrestaurant
|
||||
RUN gem install bundler
|
||||
#RUN bundle update --bundler
|
||||
RUN bundle install --without development test
|
||||
RUN bundle exec rake assets:precompile
|
||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
||||
FROM ruby:2.6.10-slim-bullseye
|
||||
|
||||
# Install dependencies (MySQL client + ImageMagick for CarrierWave/MiniMagick)
|
||||
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
default-libmysqlclient-dev \
|
||||
nodejs \
|
||||
git \
|
||||
curl \
|
||||
imagemagick \
|
||||
libmagickwand-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install correct bundler version (must match Gemfile.lock BUNDLED WITH)
|
||||
RUN gem install bundler:2.4.21
|
||||
|
||||
# Install gems
|
||||
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'
|
||||
|
||||
ruby '2.6.5'
|
||||
ruby '~> 2.6.0'
|
||||
#ruby '2.5.7'
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ gem 'mini_magick'
|
||||
gem 'jquery-fileupload-rails', '~> 0.4.7'
|
||||
|
||||
#Report and Printing gems
|
||||
gem 'cups', '~> 0.0.7'
|
||||
# gem 'cups', '~> 0.0.7'
|
||||
|
||||
gem 'prawn'
|
||||
gem 'prawn-table'
|
||||
|
||||
@@ -96,7 +96,6 @@ GEM
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.2.3)
|
||||
crass (1.0.6)
|
||||
cups (0.0.7)
|
||||
database_cleaner (1.8.5)
|
||||
diff-lcs (1.4.4)
|
||||
erubi (1.9.0)
|
||||
@@ -360,7 +359,6 @@ DEPENDENCIES
|
||||
carrierwave (~> 1.0)
|
||||
chartkick
|
||||
coffee-rails (~> 4.2)
|
||||
cups (~> 0.0.7)
|
||||
database_cleaner
|
||||
factory_girl_rails (~> 4.0)
|
||||
faker
|
||||
|
||||
@@ -289,5 +289,27 @@ App.checkin = App.cable.subscriptions.create("SecondDisplayViewChannel", {
|
||||
jQuery("#s_reload").click();
|
||||
}, 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]
|
||||
@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}"
|
||||
|
||||
# if params[:type] == "transaction"
|
||||
@@ -35,6 +35,18 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@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)
|
||||
begin
|
||||
@cash = 0.0
|
||||
@@ -421,6 +433,9 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
def create
|
||||
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
|
||||
render json: { status: false, message: "User not authenticated or employee context missing." }, status: :unauthorized
|
||||
return
|
||||
@@ -434,10 +449,10 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
||||
PaymentGatewayAuditJob.perform_later({
|
||||
receipt_no: Sale.find_by(sale_id: sale_id).receipt_no,
|
||||
gateway_name: "MMQR",
|
||||
endpoint_url: "",
|
||||
endpoint_url: "Response from foodcourt server",
|
||||
event_type: "kbz.payment.success",
|
||||
request_body: {},
|
||||
response_body: {},
|
||||
response_body: params[:response_data].to_json,
|
||||
request_method: nil,
|
||||
shop_code: Shop.current_shop.shop_code
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@ class License
|
||||
cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
redis = Redis.new
|
||||
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||
cache_license = redis.get(cache_key)
|
||||
|
||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
@@ -54,7 +54,7 @@ class License
|
||||
|
||||
#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.sadd("License:cache:keys", cache_key)
|
||||
# Redis.current do |conn|
|
||||
@@ -110,7 +110,7 @@ class License
|
||||
|
||||
# if cache_license.nil?
|
||||
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))
|
||||
# end
|
||||
|
||||
@@ -308,14 +308,14 @@ class License
|
||||
cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
redis = Redis.new
|
||||
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||
cache_license = redis.get(cache_key)
|
||||
|
||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
|
||||
if cache_license.nil?
|
||||
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))
|
||||
end
|
||||
return true
|
||||
@@ -332,7 +332,7 @@ class License
|
||||
cache_key = "shop:#{shop.chomp}"
|
||||
|
||||
##Get redis connection from connection pool
|
||||
redis = Redis.new
|
||||
redis = Redis.new(url: ENV['REDIS_URL'])
|
||||
cache_shop = redis.get(cache_key)
|
||||
|
||||
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)
|
||||
.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 = ''
|
||||
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(', '))
|
||||
@@ -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 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='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 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 = 'SALEVOID' THEN grand_total ELSE 0 END),0) as 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,
|
||||
#{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,
|
||||
@@ -785,8 +793,7 @@ class Sale < ApplicationRecord
|
||||
#{sales.to_sql}
|
||||
) as s
|
||||
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 sale_audits sa_mmqr ON s.sale_id = sa_mmqr.sale_id AND sa_mmqr.action = 'CANCEL_MMQR_PAYMENT'
|
||||
LEFT JOIN (#{void_audits.to_sql}) AS `void_audits` ON `void_audits`.`sale_id` = `s`.`sale_id`
|
||||
GROUP BY DATE(CONVERT_TZ(receipt_date,'+00:00','+06:30'))").to_hash.map(&:symbolize_keys)
|
||||
return daily_total
|
||||
end
|
||||
|
||||
@@ -84,7 +84,7 @@ class SalePayment < ApplicationRecord
|
||||
amount_due = invoice.sale_payments
|
||||
.map(&:payment_amount).reduce(invoice.grand_total, :-)
|
||||
end
|
||||
|
||||
# byebug
|
||||
if amount_due > 0
|
||||
payment_status = false
|
||||
membership_data = nil
|
||||
@@ -169,11 +169,20 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
else
|
||||
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
|
||||
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)
|
||||
|
||||
return false, "No outstanding Amount"
|
||||
return false, "No outstanding Amount", membership_data
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -121,39 +121,47 @@ class OrderSummaryPdf < Prawn::Document
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, alt_name, precision)
|
||||
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
|
||||
|
||||
order_item.each do|odi|
|
||||
sale_items.each do|sale_item|
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
if sale_item.status == 'foc' || sale_item.status == 'Discount'
|
||||
next
|
||||
end
|
||||
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
|
||||
text "#{sale_item.product_code} - #{sale_item.product_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
|
||||
text "#{number_format(sale_item.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
|
||||
text "#{sale_item.product_code} - #{sale_item.product_name}", :size => self.item_font_size,:align => :left
|
||||
|
||||
end
|
||||
|
||||
if alt_name
|
||||
if !(odi.alt_name).empty?
|
||||
if !(sale_item.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
|
||||
text "(#{sale_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# add option
|
||||
odi = OrderItem.where(item_instance_code: sale_item.item_instance_code).first
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
if options != ""
|
||||
@@ -174,6 +182,57 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
# 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
|
||||
|
||||
def get_booking_id(order_no)
|
||||
|
||||
@@ -263,6 +263,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
|
||||
if item.qty < 0 && item.status == 'void'
|
||||
total_qty += item.qty
|
||||
end
|
||||
|
||||
product_name = item.product_name
|
||||
|
||||
# if item.status = 'promotion' && (item.remark =='promotion nett price' || item.remark == 'promotion discount')
|
||||
|
||||
@@ -56,6 +56,16 @@ class KbzMerchant
|
||||
api_url = "#{@url}/queryorder"
|
||||
payload = build_query_payload(merch_order_id)
|
||||
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)
|
||||
end
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<tbody>
|
||||
<% sub_total = 0 %>
|
||||
<% @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? %>
|
||||
<tr class="item-row item" id="<%= sale_item.sale_item_id %>"
|
||||
data-account-type="<%=sale_item.account_id%>"
|
||||
@@ -271,6 +271,8 @@
|
||||
var precision = <%= precision %>;
|
||||
var originalAmount = totalAmount;
|
||||
var originalDiscount = totalDiscount;
|
||||
var queryParams = new URLSearchParams(window.location.search)
|
||||
|
||||
$(document).ready(function(){
|
||||
setHeaderBreadCrumb(_DISCOUNTS_);
|
||||
/* check webview loaded*/
|
||||
@@ -281,17 +283,10 @@
|
||||
var id = $("#table_id").text();
|
||||
var type = $("#table_type").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/';
|
||||
} 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 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 };
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -505,18 +495,11 @@
|
||||
title: "Information!",
|
||||
text: result.status,
|
||||
}, 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/';
|
||||
}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,
|
||||
type: "success",
|
||||
}, 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/';
|
||||
}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,
|
||||
type: "success",
|
||||
}, 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/';
|
||||
}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 %>
|
||||
<% @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
|
||||
%>
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
@@ -200,7 +200,7 @@
|
||||
<%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>
|
||||
<%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%>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>Refresh</button>
|
||||
<hr>
|
||||
@@ -210,6 +210,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var queryParams = new URLSearchParams(window.location.search);
|
||||
|
||||
function otherCharges(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-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
@@ -336,19 +341,11 @@
|
||||
text: "Success",
|
||||
type:"success"
|
||||
}, 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/';
|
||||
} 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? %>
|
||||
<hr>
|
||||
<% 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-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<% 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 btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<% end %>
|
||||
@@ -407,6 +409,17 @@
|
||||
<%= render "layouts/read_modal" %>
|
||||
|
||||
<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
|
||||
window.location.hash="no-back-button";
|
||||
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 connected = false;
|
||||
|
||||
let fc_server_response;
|
||||
|
||||
function handlePaymentSuccess() {
|
||||
if (paymentProcessed) return;
|
||||
paymentProcessed = true;
|
||||
@@ -347,7 +349,7 @@ $(document).ready(function() {
|
||||
headers: {
|
||||
'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) => {
|
||||
if (data.status) {
|
||||
customer_display_view({
|
||||
@@ -411,6 +413,7 @@ $(document).ready(function() {
|
||||
received(data) {
|
||||
console.log("Received:", data);
|
||||
if (data.status === "PAY_SUCCESS" && !paymentProcessed) {
|
||||
fc_server_response = data
|
||||
clearTimeout(fallbackTimeout);
|
||||
handlePaymentSuccess();
|
||||
}
|
||||
|
||||
@@ -259,9 +259,11 @@
|
||||
<% if @sale_payment.nil? %>
|
||||
<hr>
|
||||
<% 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-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<% 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 btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<% end %>
|
||||
@@ -465,6 +467,19 @@ var paymalcount = <%= @paymalcount %>;
|
||||
var customer_paypar_account = '<%= @sale_data.customer.paypar_account_no %>';
|
||||
// console.log(pdf_view)
|
||||
$(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');
|
||||
/* replace url type*/
|
||||
if(!trans_flag){
|
||||
@@ -557,7 +572,7 @@ $(document).ready(function(){
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
}
|
||||
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 {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
@@ -575,7 +590,7 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
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 {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
@@ -591,9 +606,9 @@ $(document).ready(function(){
|
||||
var sale_id = $('#sale_id').text();
|
||||
if ($(this).attr('active')=== "true") {
|
||||
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{
|
||||
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{
|
||||
@@ -1010,7 +1025,7 @@ $(document).ready(function(){
|
||||
if (type == "edit") {
|
||||
var dining_id = $('#dining').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"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#voidModal').modal('show');
|
||||
@@ -1175,7 +1190,7 @@ $(document).ready(function(){
|
||||
if(data.status){
|
||||
// console.log(type);
|
||||
localStorage.setItem("tax_type", type);
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment';
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -237,6 +237,8 @@
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
var queryParams = new URLSearchParams(window.location.search);
|
||||
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -370,15 +372,12 @@ var access_code = localStorage.getItem("access_code");
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_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/';
|
||||
}
|
||||
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 () {
|
||||
@@ -403,16 +402,11 @@ var access_code = localStorage.getItem("access_code");
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
||||
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/';
|
||||
}
|
||||
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>
|
||||
</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>
|
||||
</tr>
|
||||
<tr class="table-active">
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
.new-design-navbar .navbar-brand:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.new-design-navbar .navbar-brand img {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.new-design-navbar .navbar-brand .material-icons {
|
||||
margin-right: 8px;
|
||||
@@ -145,25 +148,60 @@
|
||||
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>
|
||||
|
||||
<%# Top Bar - New Design %>
|
||||
<% if !request.path_info.include?('second_display') %>
|
||||
<nav class="navbar new-design-navbar mb-1" style="position: sticky;">
|
||||
<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" %>
|
||||
<a href="javascript:void(0);" class="bars bars-toggle">
|
||||
<!-- <i class="material-icons">menu</i> -->
|
||||
</a>
|
||||
<% end %>
|
||||
<%# Brand Name and Icon %>
|
||||
<a class="navbar-brand" href="<%= root_path %>">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="navbar-center-section">
|
||||
<%= Shop.current_shop.name %>
|
||||
</div>
|
||||
<div class="navbar-right-section">
|
||||
<%# Connection Status %>
|
||||
<div class="nav-item" id="connection-status-item">
|
||||
@@ -175,7 +213,7 @@
|
||||
<div class="nav-item dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
<i class="material-icons">person</i>
|
||||
<span><%= current_login_employee.name %></span>
|
||||
<span class="user-name-text"><%= current_login_employee.name %></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<% 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.credit_sales") %></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>
|
||||
<% end %>
|
||||
<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>
|
||||
<% 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[: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>
|
||||
<% 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>
|
||||
<% 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[: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(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>
|
||||
<% 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>
|
||||
<% end %>
|
||||
<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>
|
||||
|
||||
|
||||
@@ -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.credit_sales") %></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>
|
||||
<% end %>
|
||||
<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>
|
||||
<% 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[: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>
|
||||
<% 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>
|
||||
<% 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[: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(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>
|
||||
<% 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>
|
||||
<% end %>
|
||||
<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>
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
<select class="form-control select" name="shift_name" id="shift_name" style="height: 37px;">
|
||||
</select>
|
||||
</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">
|
||||
<label class="font-20 mbl_lbl">Status</label>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20 mbl-right-btn mbl-style">
|
||||
<br>
|
||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
redis: &redis
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
||||
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>
|
||||
|
||||
production: *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|
|
||||
ENV[key.upcase] = value.to_s
|
||||
ENV[key.upcase] ||= value.to_s
|
||||
end
|
||||
|
||||
# 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|
|
||||
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
|
||||
|
||||
@@ -424,7 +424,7 @@ en:
|
||||
to_date: "To Date"
|
||||
sr: "Sr"
|
||||
void_amount: "Void Amount"
|
||||
mmqr_void_amount: "MMQR Void Amount"
|
||||
mmqr_void_amount: "MMQR Cancel Amount"
|
||||
mpu_sales: "MPU Sales"
|
||||
master_sales: "Master 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:
|
||||
<<: *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:
|
||||
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
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
@@ -20,11 +8,9 @@ development:
|
||||
test:
|
||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
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
|
||||
server_mode: application
|
||||
cipher_type: AES-256-CBC
|
||||
sx_key: Wh@t1$C2L
|
||||
secret_key_base: <%= ENV.fetch('SECRET_KEY_BASE', 'c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22') %>
|
||||
sx_provision_url: <%= ENV.fetch('SX_PROVISION_URL', 'connect.smartsales.asia/api') %>
|
||||
server_mode: <%= ENV.fetch('SERVER_MODE', 'cloud') %>
|
||||
cipher_type: <%= ENV.fetch('CIPHER_TYPE', 'AES-256-CBC') %>
|
||||
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