fixed conflict after merge with dev
This commit is contained in:
@@ -96,9 +96,6 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||
end
|
||||
end
|
||||
|
||||
# puts "!!! send doemal ::"
|
||||
# puts result
|
||||
|
||||
Rails.logger.debug "send status to doemal"
|
||||
Rails.logger.debug result
|
||||
|
||||
@@ -46,9 +46,6 @@ class Api::OrdersController < Api::ApiController
|
||||
@tax_profile = TaxProfile.where("lower(group_type)='cashier'")
|
||||
# end
|
||||
|
||||
# @shop = Shop.first
|
||||
puts "Hello world"
|
||||
puts @shop.to_json
|
||||
return @shop.to_json
|
||||
end
|
||||
|
||||
@@ -150,7 +147,6 @@ class Api::OrdersController < Api::ApiController
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
|
||||
@@ -15,10 +15,6 @@ class Api::SurveyController < Api::ApiController
|
||||
|
||||
def create
|
||||
dining_facility = DiningFacility.find(params[:id])
|
||||
# cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
# puts params.to_json
|
||||
# set cashier
|
||||
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
|
||||
current_shift = ShiftSale.current_shift(@shop.shop_code)
|
||||
current_shift_user =Employee.find_by_id(current_shift.employee_id)
|
||||
|
||||
@@ -26,61 +26,51 @@ class BaseReportController < ActionController::Base
|
||||
}
|
||||
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now.utc.getlocal
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
|
||||
if from.present? && to.present?
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.parse(params[:from])
|
||||
to = Time.parse(params[:to])
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = Time.now
|
||||
to = Time.now
|
||||
when PERIOD["yesterday"]
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week
|
||||
to = Time.now
|
||||
when PERIOD["last_week"]
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = 7.day.ago
|
||||
to = Time.now
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month
|
||||
to = Time.now
|
||||
when PERIOD["last_month"]
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = 30.day.ago
|
||||
to = Time.now
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year
|
||||
to = Time.now
|
||||
when PERIOD["last_year"]
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
end
|
||||
end
|
||||
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
else
|
||||
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
end
|
||||
|
||||
def check_user
|
||||
|
||||
@@ -56,7 +56,7 @@ module LicenseVerification
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
Rails.logger.info "License successed"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ module LoginVerification
|
||||
|
||||
def current_shop
|
||||
begin
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop =Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
rescue
|
||||
@@ -42,7 +42,7 @@ module LoginVerification
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop = Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
end
|
||||
@@ -91,7 +91,7 @@ module LoginVerification
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user =Employee.authenticate_by_token(token,current_shop)
|
||||
@user = Employee.authenticate_by_token(token,current_shop)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
|
||||
@@ -3,40 +3,43 @@ module NumberFormattable
|
||||
|
||||
def precision
|
||||
@precision ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'precision'}
|
||||
if @precision
|
||||
@precision.value.to_i
|
||||
else
|
||||
if @precision.nil?
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
@print_settings.precision.to_i
|
||||
@precision = OpenStruct.new(value: @print_settings.precision.to_i)
|
||||
else
|
||||
@precision = OpenStruct.new(value: 2)
|
||||
end
|
||||
end || 2
|
||||
end
|
||||
@precison_value ||= @precision.value.to_i
|
||||
end
|
||||
|
||||
def delimiter
|
||||
@delimiter ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'delimiter'}
|
||||
if @delimiter
|
||||
@delimiter_value ||= @delimiter.value.to_s.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") }
|
||||
else
|
||||
if @delimiter.nil?
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
"," if @print_settings.delimiter
|
||||
if @print_settings && @print_settings.delimiter
|
||||
@delimiter = OpenStruct.new(value: ",")
|
||||
else
|
||||
@delimiter = OpenStruct.new(value: "")
|
||||
end
|
||||
end || ""
|
||||
end
|
||||
@delimiter_value ||= @delimiter.value.to_s.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") }
|
||||
end
|
||||
|
||||
def strip_insignificant_zeros
|
||||
@strip_insignificant_zeros ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'strip_insignificant_zeros'}
|
||||
if @strip_insignificant_zeros
|
||||
['1', 't', 'true', 'on', 'y', 'yes'].include? @strip_insignificant_zeros.value.to_s
|
||||
end || false
|
||||
if @strip_insignificant_zeros.nil?
|
||||
@strip_insignificant_zeros = OpenStruct.new(value: false)
|
||||
end
|
||||
@strip_insignificant_zeros_value ||= ['1', 't', 'true', 'on', 'y', 'yes'].include? @strip_insignificant_zeros.value.to_s
|
||||
end
|
||||
|
||||
def number_format(number, options = {})
|
||||
options[:precision] = options[:precision] || precision
|
||||
# options[:delimiter] = options[:delimiter] || delimiter
|
||||
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
||||
|
||||
|
||||
if options[:precision] > 0
|
||||
if options[:strip_insignificant_zeros]
|
||||
formatted = "%.12g" % number.round(options[:precision])
|
||||
@@ -44,10 +47,10 @@ module NumberFormattable
|
||||
formatted = "%.#{options[:precision]}f" % number.round(options[:precision])
|
||||
end
|
||||
else
|
||||
formatted = number.to_i.to_s
|
||||
formatted = number.round(options[:precision]).to_i.to_s
|
||||
end
|
||||
|
||||
if options[:delimiter] &&
|
||||
|
||||
if options[:delimiter] && !options[:delimiter].empty?
|
||||
formatted = formatted.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, "\\1#{options[:delimiter]}")
|
||||
end
|
||||
|
||||
|
||||
@@ -103,11 +103,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
# puts @crm_customers.to_json
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
|
||||
@@ -39,7 +39,6 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
# POST /crm/dining_queues
|
||||
# POST /crm/dining_queues.json
|
||||
def create
|
||||
puts dining_queue_params
|
||||
@dining_queue = DiningQueue.new(dining_queue_params)
|
||||
@dining_queue.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
|
||||
@@ -91,23 +91,12 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def dashboard
|
||||
@from, @to, @from_time, @to_time = get_date_range_from_params
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@orders = Sale.where("payment_status = 'new' and sale_status = 'bill'")
|
||||
@sales = Sale.completed
|
||||
@from, @to = get_date_range_from_params
|
||||
|
||||
if !@from.nil? && !@to.nil?
|
||||
@orders = @orders.date_between(@from, @to)
|
||||
@sales = @sales.date_between(@from, @to)
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@shop = Shop.first
|
||||
|
||||
@orders = @orders.time_between(@from_time, @to_time)
|
||||
@sales = @sales.time_between(@from_time, @to_time)
|
||||
end
|
||||
else
|
||||
@orders = @orders.date_on(today)
|
||||
@sales = @sales.date_on(today)
|
||||
end
|
||||
@orders = Sale.receipt_date_between(@from, @to).where("payment_status = 'new' and sale_status = 'bill'")
|
||||
@sales = Sale.receipt_date_between(@from, @to).completed
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
@@ -116,15 +105,11 @@ class HomeController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top", @shop)
|
||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom", @shop)
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time, @shop)
|
||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||
# .sum(:grand_total)
|
||||
logger.debug 'hourly_sales<>><><><<<<<<>><<<><><><><><><><><><<>><'
|
||||
logger.debug @hourly_sales.to_json
|
||||
employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time, @shop)
|
||||
# .sum("(CASE WHEN sp.payment_method='cash' THEN ((sp.payment_amount) - (sales.amount_changed)) ELSE (sp.payment_amount) END)")
|
||||
|
||||
@top_products = Sale.top_bottom_products(current_user,@from,@to,"top")
|
||||
@bottom_products = Sale.top_bottom_products(current_user,@from,@to,"bottom")
|
||||
@hourly_sales = Sale.hourly_sales(current_user,@from,@to)
|
||||
employee_sales = Sale.employee_sales(current_user,@from,@to)
|
||||
|
||||
@employee_sales = []
|
||||
if !employee_sales.nil?
|
||||
@@ -137,38 +122,34 @@ class HomeController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
@inventories = StockJournal.inventory_balances(today,@from,@to,@from_time,@to_time,@shop).sum(:balance)
|
||||
|
||||
@inventories = StockJournal.inventory_balances(@from,@to).sum(:balance)
|
||||
|
||||
@total_trans = Sale.total_trans(today,current_user,@from,@to,@from_time,@to_time,@shop)
|
||||
@total_card = Sale.total_card_sale(today,current_user,@from,@to,@from_time,@to_time,@shop)
|
||||
@total_credit = Sale.credit_payment(today,current_user,@from,@to,@from_time,@to_time,@shop)
|
||||
|
||||
@total_trans = Sale.total_trans(current_user,@from,@to)
|
||||
@total_card = Sale.total_card_sale(current_user,@from,@to)
|
||||
@total_credit = Sale.credit_payment(current_user,@from,@to)
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_payment_methods = Sale.total_payment_methods(current_user,@from,@to)
|
||||
|
||||
if !@total_payment_methods.nil?
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" || payment.payment_method == "unionpay" || payment.payment_method == "alipay"
|
||||
pay = Sale.payment_sale(@shop,'card', today, current_user,@from,@to,@from_time,@to_time)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(@shop,payment.payment_method, today, current_user,@from,@to,@from_time,@to_time)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
pay = Sale.payment_sale(payment.payment_method, current_user,@from,@to)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
@summ_sale = Sale.summary_sale_receipt(current_user,@from,@to)
|
||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(current_user,@from,@to)
|
||||
# @total_other_customer = Sale.total_other_customer(today,current_user)
|
||||
|
||||
@total_order = Sale.total_order(@shop, today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_order = Sale.total_order(current_user,@from,@to)
|
||||
@total_accounts = Account.select("accounts.id as account_id, accounts.title as title")
|
||||
@account_data = Array.new
|
||||
if !@total_accounts.nil?
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(@shop, account.account_id, today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
acc = Sale.account_data(account.account_id,current_user,@from,@to)
|
||||
if !acc.nil? && acc.cnt_acc > 0
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
end
|
||||
@@ -176,8 +157,8 @@ class HomeController < ApplicationController
|
||||
@total_accounts = @total_accounts.reject.with_index { |x, i| @account_data[i].nil? }
|
||||
end
|
||||
|
||||
@top_items = Sale.top_items(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_foc_items = Sale.total_foc_items(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
@top_items = Sale.top_items(current_user,@from,@to)
|
||||
@total_foc_items = Sale.total_foc_items(current_user,@from,@to)
|
||||
|
||||
# get printer info
|
||||
# @print_settings = get_precision_delimiter
|
||||
@@ -239,23 +220,18 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def get_date_range_from_params
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
from_time = params[:from_time]
|
||||
to_time = params[:to_time]
|
||||
|
||||
if from.present? && to.present?
|
||||
# f_date = DateTime.parse(from)
|
||||
# t_date = DateTime.parse(to)
|
||||
# f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
# t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
# from = f_time.beginning_of_day.utc.getlocal
|
||||
# to = t_time.end_of_day.utc.getlocal
|
||||
|
||||
from = DateTime.parse(from).utc.getlocal.strftime('%Y-%m-%d')
|
||||
to = DateTime.parse(to).utc.getlocal.strftime('%Y-%m-%d')
|
||||
if params[:from].present? && params[:to].present?
|
||||
if params[:from_time].present? && params[:to_time].present?
|
||||
from = Time.parse("#{params[:from]} #{params[:from_time]}")
|
||||
to = Time.parse("#{params[:to]} #{params[:to_time]}")
|
||||
else
|
||||
from = Time.parse(params[:from])
|
||||
to = Time.parse(params[:to]).end_of_day
|
||||
end
|
||||
|
||||
return from, to, from_time, to_time
|
||||
else
|
||||
from = Time.now.beginning_of_day
|
||||
to = Time.now.end_of_day
|
||||
end
|
||||
return from, to
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,8 +59,6 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
|
||||
#Pull this menu
|
||||
@menu_category = InventoryDefinition.search_by_category(params[:id])
|
||||
puts @menu_category.to_json
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu_category
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
|
||||
@@ -118,8 +118,6 @@ class Oqs::HomeController < BaseOqsController
|
||||
status = params[:status]
|
||||
|
||||
items = queue_items_query(false,oqs_id,filter,table_id,status)
|
||||
puts "items0"
|
||||
puts items.to_json
|
||||
if !items.empty?
|
||||
items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
|
||||
@@ -46,8 +46,6 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
@@ -63,7 +61,6 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
@menu_category = MenuCategory.where("menu_id='#{@menu.id}'").order("order_by asc")
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
Menu.current_menu
|
||||
@@ -77,8 +74,6 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
@@ -199,7 +194,6 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
|
||||
@@ -36,7 +36,6 @@ class Origami::CashInsController < BaseOrigamiController
|
||||
shift =current_shift
|
||||
end
|
||||
end
|
||||
puts shift.to_json
|
||||
shift.cash_in = shift.cash_in + amount.to_f
|
||||
shift.save
|
||||
end
|
||||
|
||||
@@ -6,31 +6,31 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
@display_type = Lookup.where("shop_code='#{@shop.shop_code}'").find_by_lookup_type("display_type")
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(@shop,today,current_user)
|
||||
|
||||
@total_payment_methods = Sale.total_payment_methods(current_user)
|
||||
if !@total_payment_methods.nil?
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" || payment.payment_method == "unionpay" || payment.payment_method == "alipay"
|
||||
pay = Sale.payment_sale(@shop,'card', today, current_user)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(@shop,payment.payment_method, today, current_user)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
pay = Sale.payment_sale(payment.payment_method, current_user)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
|
||||
end
|
||||
else
|
||||
@sale_data = nil
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(@shop,today,current_user)
|
||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(@shop,today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
@summ_sale = Sale.summary_sale_receipt(current_user)
|
||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(current_user,@from,@to)
|
||||
# @total_other_customer = Sale.total_other_customer(today,current_user)
|
||||
|
||||
@total_order = Sale.total_order(current_user)
|
||||
|
||||
@total_order = Sale.total_order(@shop, today,current_user)
|
||||
@total_accounts = Account.select("accounts.id as account_id, accounts.title as title")
|
||||
@account_data = Array.new
|
||||
if !@total_accounts.nil?
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(@shop,account.account_id, today,current_user)
|
||||
|
||||
acc = Sale.account_data(account.account_id, current_user)
|
||||
|
||||
if !acc.nil?
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
end
|
||||
@@ -40,8 +40,10 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
@account_data = nil
|
||||
end
|
||||
|
||||
@top_items = Sale.top_items(@shop,today,current_user)
|
||||
@total_foc_items = Sale.total_foc_items(@shop,today,current_user)
|
||||
|
||||
@top_items = Sale.top_items(current_user)
|
||||
@total_foc_items = Sale.total_foc_items(current_user)
|
||||
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
@@ -104,7 +106,9 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def get_all_menu
|
||||
@menus = Menu.includes(:menu_categories => {:menu_items => :menu_item_instances}).includes(:menu_categories => {:menu_items => :item_sets }).active.all.where("shop_code='#{@shop.shop_code}'")
|
||||
|
||||
@menus = Menu.includes(:menu_categories => {:menu_items => :menu_item_instances}).includes(:menu_categories => {:menu_items => :item_sets }).includes(:menu_categories => {:menu_items => {:item_sets => :menu_item_instances}}).active.all
|
||||
|
||||
@item_attributes = MenuItemAttribute.all.load
|
||||
@item_options = MenuItemOption.all.load
|
||||
end
|
||||
|
||||
@@ -134,10 +134,8 @@ class Origami::FoodCourtController < ApplicationController
|
||||
|
||||
def get_menu_category ()
|
||||
if (params[:id])
|
||||
puts params[:id]
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
@@ -150,7 +148,6 @@ class Origami::FoodCourtController < ApplicationController
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
@@ -171,7 +168,6 @@ class Origami::FoodCourtController < ApplicationController
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
|
||||
@@ -47,12 +47,6 @@ class Origami::InDutiesController < BaseOrigamiController
|
||||
def create_for_in_duty
|
||||
# this one use for create and update
|
||||
in_duty = in_duty_params
|
||||
# in_time = DateTime.new in_duty['in_time(1i)'].to_i, in_duty['in_time(2i)'].to_i, in_duty['in_time(3i)'].to_i, in_duty['in_time(4i)'].to_i, in_duty['in_time(5i)'].to_i
|
||||
# in_time = in_time.change(offset: '+06:30')
|
||||
# out_time = DateTime.new in_duty['out_time(1i)'].to_i, in_duty['out_time(2i)'].to_i, in_duty['out_time(3i)'].to_i, in_duty['out_time(4i)'].to_i, in_duty['out_time(5i)'].to_i
|
||||
# out_time = out_time.change(offset: '+06:30')
|
||||
# puts in_duty.to_json
|
||||
# puts "sssssssssssssssssss"
|
||||
@in_duty = InDuty.new
|
||||
in_duty_id = in_duty[:id]
|
||||
unless in_duty_id.empty?
|
||||
|
||||
@@ -137,10 +137,8 @@ class Origami::QuickServiceController < ApplicationController
|
||||
|
||||
def get_menu_category ()
|
||||
if (params[:id])
|
||||
puts params[:id]
|
||||
#Pull this menu
|
||||
@menu = MenuCategory.find_by_id(params[:id])
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @menu
|
||||
else
|
||||
MenuCategory.current_menu
|
||||
@@ -153,7 +151,6 @@ class Origami::QuickServiceController < ApplicationController
|
||||
if (id)
|
||||
#Pull this menu
|
||||
@sub_menu = MenuCategory.where("menu_category_id = #{id}").active
|
||||
# puts @menu.menu_items[1].item_attributes.to_json
|
||||
return @sub_menu
|
||||
end
|
||||
end
|
||||
@@ -174,7 +171,6 @@ class Origami::QuickServiceController < ApplicationController
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
class Origami::RoomInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
puts "room bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@room.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
|
||||
@@ -158,15 +158,8 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
# puts order_id
|
||||
# puts order_ids.count
|
||||
# puts order_id_count
|
||||
# puts order_items.count
|
||||
# puts order_item_count
|
||||
|
||||
if !order_id.nil?
|
||||
if order_id_count > 1
|
||||
puts "order_id_count > 1"
|
||||
|
||||
updated_order_id = Array.new
|
||||
arr_order_ids.each do |order|
|
||||
@@ -178,9 +171,6 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
# puts "updated_order_id"
|
||||
# puts updated_order_id
|
||||
|
||||
if !updated_order_id.empty?
|
||||
order_ids.each do |odr_id|
|
||||
unless updated_order_id.include?(odr_id)
|
||||
@@ -208,8 +198,6 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
# puts new_order_status
|
||||
|
||||
if new_order_status
|
||||
BookingOrder.find_by_order_id(odr_id).delete
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => odr_id})
|
||||
@@ -236,7 +224,6 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
else
|
||||
# puts "order_id_count < 1"
|
||||
new_order_status = true
|
||||
order_items.each do |order_item|
|
||||
orderItem = OrderItem.find(order_item["id"])
|
||||
@@ -249,8 +236,6 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
# puts new_order_status
|
||||
|
||||
if new_order_status
|
||||
BookingOrder.find_by_order_id(order_id).delete
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_id})
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
class Origami::TableInvoicesController < BaseOrigamiController
|
||||
def index
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
# shop = Shop.first
|
||||
puts "table bookig lenght"
|
||||
@sale_array = Array.new
|
||||
@table.bookings.each do |booking|
|
||||
puts booking.sale_id
|
||||
|
||||
if booking.sale_id.nil?
|
||||
else
|
||||
@@ -30,7 +27,6 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
# puts 'Catch me if you can.......................'
|
||||
@table = DiningFacility.find(params[:table_id])
|
||||
@membership = MembershipSetting.find_by_shop_code(@shop.shop_code)
|
||||
@payment_methods = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
|
||||
|
||||
@@ -27,9 +27,7 @@ class Reports::HourlySaleitemController < BaseReportController
|
||||
account_type = params[:account_type]
|
||||
@type = params[:sale_type]
|
||||
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
|
||||
logger.debug 'product>>>>>>>>>>>>>>>>>>>>>>>>>>'
|
||||
# logger.debug @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"Date" =>key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
|
||||
|
||||
|
||||
@hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
|
||||
logger.debug @hourly_total_qty
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ authorize_resource :class => false
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
rescue OpenURI::HTTPError
|
||||
puts "Fire in here"
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
rescue SocketError
|
||||
response = { status: false, message: "Can't open server "}
|
||||
@@ -121,9 +120,6 @@ authorize_resource :class => false
|
||||
rescue Errno::ECONNREFUSED, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
|
||||
response = { status: false, message: "Can't open membership server"}
|
||||
end
|
||||
|
||||
puts url
|
||||
puts response
|
||||
@message = @result.parsed_response['message']
|
||||
end
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ class Settings::CommissionersController < ApplicationController
|
||||
unless @commissioner.resigned_date.nil?
|
||||
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
# puts params[:from_induty].length
|
||||
if (params[:from_induty] != "true")
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
|
||||
@@ -41,7 +41,6 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
# PATCH/PUT /settings/payment_method_settings/1
|
||||
# PATCH/PUT /settings/payment_method_settings/1.json
|
||||
def update
|
||||
puts settings_payment_method_setting_params
|
||||
respond_to do |format|
|
||||
if @settings_payment_method_setting.update(settings_payment_method_setting_params)
|
||||
format.html { redirect_to settings_payment_method_setting_path(@settings_payment_method_setting), notice: 'Payment method setting was successfully updated.' }
|
||||
|
||||
@@ -117,8 +117,6 @@ class Settings::PromotionsController < ApplicationController
|
||||
end
|
||||
res.push({item_inst.menu_item.item_code => arr_inst})
|
||||
end
|
||||
puts "res"
|
||||
p res
|
||||
render json: res
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ class Settings::RoomsController < ApplicationController
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_room }
|
||||
else
|
||||
puts "abc"
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_room.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class DiningCharge < ApplicationRecord
|
||||
end
|
||||
return block_count, price
|
||||
else
|
||||
puts "<<<<<<<< NO"
|
||||
Rails.logger.info "Params not enough"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -29,11 +29,10 @@ class Sale < ApplicationRecord
|
||||
scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
|
||||
scope :paid, -> { where(payment_status: 'paid')}
|
||||
scope :completed, -> { where(sale_status: 'completed') }
|
||||
scope :date_on, -> (date) { where("DATE(CONVERT_TZ(receipt_date, '+00:00', ?)) = ?", Time.zone.formatted_offset, date) }
|
||||
scope :date_between, -> (from, to) { where("DATE(CONVERT_TZ(receipt_date, '+00:00', ?)) BETWEEN ? AND ?", Time.zone.formatted_offset, from, to) }
|
||||
scope :time_between, -> (from, to) { where("TIME(CONVERT_TZ(receipt_date, '+00:00', ?)) BETWEEN ? AND ?", Time.zone.formatted_offset, from, to) }
|
||||
|
||||
scope :along_with_sale_payments_except_void, -> { joins("LEFT JOIN sale_payments on sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND DATE(CONVERT_TZ(sale_payments.created_at,'+00:00', '#{Time.zone.formatted_offset}')) = DATE(CONVERT_TZ(sales.receipt_date,'+00:00', '#{Time.zone.formatted_offset}'))") }
|
||||
scope :receipt_date_between, -> (from, to) { where(receipt_date: from..to) }
|
||||
scope :along_with_sale_payments_except_void_between, -> (from, to) { joins(sanitize_sql_array(["LEFT JOIN sale_payments on sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND sale_payments.created_at BETWEEN ? and ?", from, to])) }
|
||||
|
||||
|
||||
def qty_of(item_instance_code)
|
||||
order_items.select(:order_items_id, :item_instance_code, 'SUM(qty) as qty').where(item_instance_code: item_instance_code).group(:item_instance_code).first
|
||||
@@ -848,8 +847,9 @@ def self.daily_sales_list(from,to,shop_code)
|
||||
ELSE 0 END as credit_amount,
|
||||
SUM(case when (sale_payments.payment_method='giftvoucher') then sale_payments.payment_amount else 0 end) as giftvoucher_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||
.along_with_sale_payments_except_void
|
||||
.where("shop_code='#{shop_code}' and (sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
|
||||
|
||||
.along_with_sale_payments_except_void_between(from, to)
|
||||
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
|
||||
.group("sale_id").to_sql
|
||||
|
||||
daily_total = connection.select_all("SELECT
|
||||
@@ -1579,20 +1579,17 @@ end
|
||||
return tax
|
||||
end
|
||||
|
||||
def self.top_bottom_products(today,current_user,from,to,from_time,to_time,type, shop)
|
||||
|
||||
def self.top_bottom_products(current_user,from,to,type)
|
||||
query = Sale.joins("JOIN sale_items ON sale_items.sale_id = sales.sale_id")
|
||||
.completed
|
||||
.where("qty > 0 AND price > 0 AND shop_code='#{shop.shop_code}'")
|
||||
.group("SUBSTRING_INDEX(product_name, ' - ', 1)")
|
||||
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
@@ -1609,17 +1606,14 @@ end
|
||||
query.limit(20).sum('qty')
|
||||
end
|
||||
|
||||
def self.hourly_sales(today,current_user,from,to,from_time,to_time, shop)
|
||||
query = Sale.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||
|
||||
def self.hourly_sales(current_user,from,to)
|
||||
query = Sale.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '#{Time.zone.formatted_offset}'), '%I %p')")
|
||||
|
||||
.order('receipt_date').completed
|
||||
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1627,63 +1621,69 @@ end
|
||||
query = query.where("shift_sale_id='#{shift.id}'")
|
||||
end
|
||||
end
|
||||
|
||||
query.sum(:grand_total)
|
||||
end
|
||||
|
||||
def self.employee_sales(today,current_user,from,to,from_time,to_time,shop)
|
||||
|
||||
def self.employee_sales(current_user,from,to)
|
||||
|
||||
shift = if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
ShiftSale.current_open_shift(current_user)
|
||||
end
|
||||
|
||||
payments_for_credits = SalePayment.joins(:sale_audit).to_sql
|
||||
|
||||
query = employee_sale(shop,today, shift, from, to, from_time, to_time)
|
||||
|
||||
query = employee_sale(shift, from, to)
|
||||
|
||||
.joins("LEFT JOIN (#{payments_for_credits}) payments_for_credits ON payments_for_credits.sale_id = sales.sale_id")
|
||||
.select("SUM(sale_payments.payment_amount) - CASE WHEN sale_payments.payment_method = 'creditnote' THEN IFNULL(SUM(payments_for_credits.payment_amount), 0) ELSE ABS(SUM(CASE WHEN sale_payments.outstanding_amount < 0 THEN sale_payments.outstanding_amount ELSE 0 END)) END AS payment_amount,
|
||||
CASE WHEN sale_payments.payment_method IN ('mpu', 'visa', 'master', 'jcb', 'unionpay', 'alipay', 'paymal', 'dinga', 'JunctionPay', 'giftvoucher') THEN 'card'
|
||||
ELSE sale_payments.payment_method END AS payment_method, employees.name AS e_name")
|
||||
end
|
||||
|
||||
def self.total_trans(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil,shop)
|
||||
query = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count")
|
||||
.where("sale_status = 'completed' AND shop_code='#{shop.shop_code}'")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
def self.total_trans(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select("SUM(grand_total) as total_sale, COUNT(sales.sale_id) as total_count")
|
||||
.where('sale_status = "completed"')
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
def self.total_card_sale(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil,shop)
|
||||
|
||||
def self.total_card_sale(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed' and (sp.payment_method = 'mpu' or sp.payment_method = 'visa' or sp.payment_method = 'master' or sp.payment_method = 'jcb' or sp.payment_method = 'unionpay' or sp.payment_method = 'alipay' or sp.payment_method = 'paymal' or sp.payment_method = 'dinga' or sp.payment_method = 'JunctionPay')")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where('sales.sale_status = "completed" and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay" or sp.payment_method = "alipay" or sp.payment_method = "paymal" or sp.payment_method = "dinga" or sp.payment_method = "JunctionPay")')
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.sum("sp.payment_amount")
|
||||
end
|
||||
|
||||
def self.credit_payment(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil,shop)
|
||||
|
||||
def self.credit_payment(current_user=nil,from=nil,to=nil)
|
||||
|
||||
payments_for_credits = SalePayment.joins(:sale_audit).to_sql
|
||||
|
||||
query = SalePayment.credits
|
||||
@@ -1691,14 +1691,10 @@ end
|
||||
.joins("LEFT JOIN (#{payments_for_credits}) payments_for_credits ON payments_for_credits.sale_id = sale_payments.sale_id")
|
||||
.where("sale_payments.payment_method= ? AND sales.sale_status = ? AND sales.shop_code=?", 'creditnote', 'completed',shop.shop_code)
|
||||
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.merge(Sale.date_between(from, to))
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.merge(Sale.time_between(from_time, to_time))
|
||||
end
|
||||
else
|
||||
query = query.merge(Sale.date_on(today))
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.merge(Sale.receipt_date_between(from, to))
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
@@ -1708,46 +1704,49 @@ end
|
||||
return query.sum("sale_payments.payment_amount - IFNULL(payments_for_credits.payment_amount, 0)")
|
||||
end
|
||||
|
||||
def self.summary_sale_receipt(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.summary_sale_receipt(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax')
|
||||
.where("shop_code='#{shop.shop_code}' and sale_status = 'completed'")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where('sale_status = "completed"')
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.first()
|
||||
end
|
||||
|
||||
def self.total_payment_methods(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
query = Sale.select("distinct sp.payment_method")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed'")
|
||||
|
||||
def self.total_payment_methods(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select("CASE WHEN sp.payment_method IN ('mpu', 'visa', 'master', 'jcb', 'unionpay', 'alipay', 'paymal', 'dinga', 'JunctionPay', 'giftvoucher') THEN 'card' ELSE sp.payment_method END as payment_method")
|
||||
.where("sales.sale_status = 'completed'")
|
||||
|
||||
.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.group("CASE WHEN sp.payment_method IN ('mpu', 'visa', 'master', 'jcb', 'unionpay', 'alipay', 'paymal', 'dinga', 'JunctionPay', 'giftvoucher') THEN 'card' ELSE sp.payment_method END")
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
return query
|
||||
end
|
||||
|
||||
def self.payment_sale(shop,payment_method, today, current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.payment_sale(payment_method, current_user=nil,from=nil,to=nil)
|
||||
|
||||
payments_for_credits = SalePayment.joins(:sale_audit).to_sql
|
||||
|
||||
query = Sale.select("SUM(sale_payments.payment_amount) - CASE WHEN sale_payments.payment_method = 'creditnote' THEN IFNULL(SUM(payments_for_credits.payment_amount), 0) ELSE ABS(SUM(CASE WHEN sale_payments.outstanding_amount < 0 THEN sale_payments.outstanding_amount ELSE 0 END)) END AS payment_amount")
|
||||
@@ -1762,13 +1761,8 @@ end
|
||||
query = query.where("sale_payments.payment_method = ?", payment_method)
|
||||
end
|
||||
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time,to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1776,25 +1770,35 @@ end
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query.first
|
||||
end
|
||||
|
||||
def self.total_customer(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
total_dinein_takeaway = self.total_dinein_takeaway(shop,today,current_user,from,to,from_time,to_time)
|
||||
|
||||
def self.total_customer(current_user=nil,from=nil,to=nil)
|
||||
total_dinein_takeaway = self.total_dinein_takeaway(current_user,from,to)
|
||||
|
||||
dinein_cnt = 0
|
||||
takeaway_cnt = 0
|
||||
|
||||
if !total_dinein_takeaway.nil?
|
||||
if total_dinein_takeaway[0]
|
||||
dinein_cnt = total_dinein_takeaway[0].total_dinein_cus
|
||||
takeaway_cnt = total_dinein_takeaway[0].total_take_cus
|
||||
end
|
||||
end
|
||||
membership_cnt = self.total_membership(shop,today,current_user,from,to,from_time,to_time)
|
||||
|
||||
|
||||
membership_cnt = self.total_membership(current_user,from,to)
|
||||
|
||||
member_cnt = 0
|
||||
|
||||
if !membership_cnt.nil?
|
||||
member_cnt = membership_cnt.total_memb_cus
|
||||
end
|
||||
|
||||
total_cus = 0
|
||||
|
||||
if dinein_cnt > dinein_cnt || takeaway_cnt > 0 || !membership_cnt.nil?
|
||||
total_cus = dinein_cnt.to_int + takeaway_cnt.to_int + member_cnt.to_int
|
||||
end
|
||||
@@ -1802,43 +1806,43 @@ end
|
||||
return total_cus, dinein_cnt, takeaway_cnt, member_cnt
|
||||
end
|
||||
|
||||
def self.total_dinein_takeaway(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.total_dinein_takeaway(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select("(CASE WHEN c.customer_type='Dinein' THEN count(sales.customer_id) ELSE 0 END) as total_dinein_cus, (CASE WHEN c.customer_type='Takeaway' THEN count(sales.customer_id) ELSE 0 END) as total_take_cus")
|
||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed' and c.membership_id is null")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where('sales.sale_status = "completed" and c.membership_id is null')
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.first()
|
||||
end
|
||||
|
||||
def self.total_membership(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.total_membership(current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed' and ((c.customer_type = 'Dinein' and c.membership_id is not null) or (c.customer_type = 'Takeaway' and c.membership_id is not null))")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where('sales.sale_status = "completed" and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))')
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.first()
|
||||
end
|
||||
|
||||
@@ -1888,18 +1892,16 @@ end
|
||||
# query = query.first()
|
||||
# end
|
||||
|
||||
def self.total_order(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.total_order(current_user=nil,from=nil,to=nil)
|
||||
|
||||
query = Sale.select("count(distinct sale_orders.order_id) as total_order")
|
||||
.joins(:sale_orders)
|
||||
.where("shop_code='#{shop.shop_code}'")
|
||||
.completed
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1911,64 +1913,64 @@ end
|
||||
query = query.first
|
||||
end
|
||||
|
||||
def self.account_data(shop, account_id, today, current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.account_data(account_id, current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc")
|
||||
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed' and a.account_id ='#{account_id}'")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}'")
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.first
|
||||
end
|
||||
|
||||
def self.top_items(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.top_items(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price")
|
||||
.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and (a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed'")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed'")
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.group("a.product_code")
|
||||
.order("SUM(a.qty) DESC")
|
||||
.first()
|
||||
end
|
||||
|
||||
def self.total_foc_items(shop,today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
def self.total_foc_items(current_user=nil,from=nil,to=nil)
|
||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}' and sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%'")
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
.where("sales.sale_status = 'completed' and a.status='foc' and a.product_name like '%FOC%'")
|
||||
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user)
|
||||
query = query.where("sales.shift_sale_id = ?", shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
query = query.count()
|
||||
end
|
||||
|
||||
@@ -2107,17 +2109,13 @@ def unique_tax_profiles(order_source, customer_id)
|
||||
end
|
||||
|
||||
|
||||
def self.employee_sale(shop, today,shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
def self.employee_sale(shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
|
||||
query = Sale.joins(:cashier)
|
||||
.joins(:sale_payments)
|
||||
.paid.completed.where("sales.shop_code='#{shop.shop_code}'")
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.date_between(from, to)
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.time_between(from_time, to_time)
|
||||
end
|
||||
else
|
||||
query = query.date_on(today)
|
||||
query = query.receipt_date_between(from, to)
|
||||
end
|
||||
|
||||
if !shift.nil?
|
||||
|
||||
@@ -369,10 +369,10 @@ class SaleItem < ApplicationRecord
|
||||
if self.qty.to_i >= 0
|
||||
qty = self.qty - self.qty_was
|
||||
if stock.balance.to_i >= qty
|
||||
puts ">> stock is greater than order qty"
|
||||
Rails.logger.info ">> stock is greater than order qty"
|
||||
remark = "ok"
|
||||
else
|
||||
puts " << stock is less than order qty"
|
||||
Rails.logger.info " << stock is less than order qty"
|
||||
remark = "out of stock"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,8 +70,6 @@ class SalePayment < ApplicationRecord
|
||||
self.sale = invoice
|
||||
self.received_amount = cash_amount
|
||||
self.payment_reference = remark
|
||||
# puts action_by
|
||||
# puts "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
self.action_by = action_by
|
||||
#get all payment for this invoices
|
||||
if payment_for
|
||||
@@ -242,10 +240,7 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
# membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
membership_actions_data = PaymentMethodSetting.find_by_payment_method("Redeem")
|
||||
puts "This is membership_actions_data"
|
||||
puts membership_actions_data.to_json
|
||||
if !membership_actions_data.nil?
|
||||
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
@@ -334,8 +329,7 @@ class SalePayment < ApplicationRecord
|
||||
merchant_uid:merchant_uid,
|
||||
auth_token:auth_token}.to_json
|
||||
end
|
||||
|
||||
puts params
|
||||
|
||||
# Control for Paypar Cloud
|
||||
begin
|
||||
response = HTTParty.post(url,
|
||||
|
||||
@@ -4,6 +4,8 @@ class StockJournal < ApplicationRecord
|
||||
ORDER_TRANS = "order"
|
||||
STOCK_CHECK_TRANS = "stock_check"
|
||||
|
||||
scope :created_at_between, -> (from, to) { where(created_at: from..to)}
|
||||
|
||||
def self.add_to_journal(item_instance_code, qty, old_balance, stock_message, inventory_definition, trans_ref, trans_type) # item => saleObj | balance => Stock journal
|
||||
|
||||
balance = calculate_balance(old_balance, qty)
|
||||
@@ -56,23 +58,14 @@ class StockJournal < ApplicationRecord
|
||||
journal.save
|
||||
end
|
||||
|
||||
def self.inventory_balances(today,from,to,from_time,to_time,shop)
|
||||
|
||||
def self.inventory_balances(from,to, shop)
|
||||
query = StockJournal.select("mii.item_instance_name as item_instance_name,balance")
|
||||
.joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code")
|
||||
.group("mii.item_instance_name")
|
||||
.order("mii.item_instance_name ASC")
|
||||
if !from.nil? && !to.nil?
|
||||
query = StockJournal.select("mii.item_instance_name as item_instance_name,balance")
|
||||
.joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code")
|
||||
if !from_time.nil? && !to_time.nil?
|
||||
query = query.where("DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'")
|
||||
else
|
||||
query = query.where("DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}'")
|
||||
end
|
||||
query = query.where("shop_code='#{shop.shop_code}'").group("mii.item_instance_name")
|
||||
.order("mii.item_instance_name ASC")
|
||||
else
|
||||
query = StockJournal.select("mii.item_instance_name as item_instance_name,balance")
|
||||
.joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code")
|
||||
.where("shop_code='#{shop.shop_code}' and DATE_FORMAT(stock_journals.created_at,'%Y-%m-%d') = '#{today}'")
|
||||
.group("mii.item_instance_name")
|
||||
.order("mii.item_instance_name ASC")
|
||||
query = query.created_at_between(from, to)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ class VerifyNumber < ApplicationRecord
|
||||
|
||||
url = "http://smspoh.com/api/http/send?key=5QfyN0OtGsFXnOqwtpVAGZCyPGP28nbX_Nm_oPsUw2ybq714T_951ycz3Ypl5URA&message=Doemal,+Pin+Code:+"+pin.to_s+"&recipients="+ phone.to_s
|
||||
|
||||
puts url
|
||||
begin
|
||||
@result = HTTParty.get(url.to_str)
|
||||
|
||||
@@ -18,7 +17,6 @@ class VerifyNumber < ApplicationRecord
|
||||
response = { status: false, message: "Can't open membership server "}
|
||||
end
|
||||
puts @result
|
||||
puts "<><><><><><<><>><><"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -67,24 +67,16 @@
|
||||
<div class="row clearfix">
|
||||
<%
|
||||
if !@from.nil? && @from != ""
|
||||
from_date = DateTime.parse(@from).utc.getlocal.strftime("%d-%m-%Y")
|
||||
from_date = @from.strftime("%d-%m-%Y")
|
||||
from_time = @from.strftime("%H:%M") if @from.strftime("%H:%M") != "00:00"
|
||||
else
|
||||
from_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
|
||||
from_date = Time.now.strftime('%d-%m-%Y')
|
||||
end
|
||||
if !@to.nil? && @to != ""
|
||||
to_date = DateTime.parse(@to).utc.getlocal.strftime("%d-%m-%Y")
|
||||
to_date = @to.strftime("%d-%m-%Y")
|
||||
to_time = @to.strftime("%H:%M") if @to.strftime("%H:%M") != "23:59"
|
||||
else
|
||||
to_date = Time.now.utc.getlocal.strftime('%d-%m-%Y')
|
||||
end
|
||||
if !@from_time.nil?
|
||||
from_time = @from_time
|
||||
else
|
||||
from_time = ''
|
||||
end
|
||||
if !@to_time.nil?
|
||||
to_time = @to_time
|
||||
else
|
||||
to_time = ''
|
||||
to_date = Time.now.strftime('%d-%m-%Y')
|
||||
end
|
||||
%>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
|
||||
@@ -218,27 +210,22 @@
|
||||
<table class="table">
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' && payment.payment_method != 'unionpay' %>
|
||||
<tr>
|
||||
<% if payment.payment_method == 'paypar' %>
|
||||
<td>Redeem Sale : </td>
|
||||
<% else %>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<% end %>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
|
||||
<%= number_format(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if payment.payment_method != 'card' %>
|
||||
<tr>
|
||||
<% if payment.payment_method == 'paypar' %>
|
||||
<td>Redeem Sale : </td>
|
||||
<% else %>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<% end %>
|
||||
<td align="right">
|
||||
<%= number_format(@sale_data.find {|x| x.key?(payment.payment_method) }[payment.payment_method], precision: precision.to_i ,delimiter: delimiter) rescue number_format(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
|
||||
<% total_card = @sale_data.find {|x| x.key?("card") } %>
|
||||
<% if !total_card.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||
|
||||
@@ -80,7 +80,7 @@ if (menu.menu_categories)
|
||||
alt_name: its.alt_name,
|
||||
min_selectable_qty: its.min_selectable_qty,
|
||||
max_selectable_qty: its.max_selectable_qty,
|
||||
instances: its.menu_item_instances.pluck(:id).map { |id| {id: id}}
|
||||
instances: its.menu_item_instances.map { |id| {id: id}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ActionController::Base
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
Rails.logger.info "Run License"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace :clear do
|
||||
OrderReservation.delete_all
|
||||
OrderReservationItem.delete_all
|
||||
Delivery.delete_all
|
||||
puts "Clear Data Done."
|
||||
end
|
||||
|
||||
desc "Clear-- Menu"
|
||||
@@ -47,7 +46,6 @@ namespace :clear do
|
||||
Menu.destroy_all
|
||||
|
||||
Account.destroy_all
|
||||
puts "Clear all Menu Done."
|
||||
end
|
||||
|
||||
desc "Clear-- Inventory"
|
||||
@@ -60,7 +58,5 @@ namespace :clear do
|
||||
StockCheck.destroy_all
|
||||
|
||||
StockCheckItem.destroy_all
|
||||
|
||||
puts "Clear all Menu Done."
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user