shops
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
class Api::VerificationsController < ActionController::API
|
||||
|
||||
def request_code
|
||||
|
||||
phone_number = params[:phone_number]
|
||||
|
||||
#TODO - user generate
|
||||
|
||||
if @user.pin.nil?
|
||||
@user.pin = rand(1000..9999)
|
||||
@user.contact_no = phone_number
|
||||
@user.pin_send_at = Time.now
|
||||
@user.save
|
||||
VerifyNumber.send_message(@user.contact_no, @user.pin)
|
||||
#sent message
|
||||
else
|
||||
@user.contact_no = phone_number
|
||||
@user.save
|
||||
VerifyNumber.send_message(@user.contact_no, @user.pin)
|
||||
#sent message
|
||||
end
|
||||
end
|
||||
|
||||
def verify_code
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,9 @@
|
||||
class Api::ShopsController < Api::ApiController
|
||||
|
||||
skip_before_action :authenticate
|
||||
|
||||
def index
|
||||
|
||||
@shops = Shop.select('id,logo,name,shop_code,address,phone_no,cloud_url,cloud_token').all
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
class HomeController < ApplicationController
|
||||
# layout "application", except: [:index, :show]
|
||||
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||
|
||||
include PrecisionHelper
|
||||
before_action :check_user, only: :dashboard
|
||||
|
||||
|
||||
# Special check for only dashboard
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
@@ -90,9 +90,7 @@ class HomeController < ApplicationController
|
||||
|
||||
def dashboard
|
||||
@from, @to, @from_time, @to_time = get_date_range_from_params
|
||||
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
if !@from.nil? && !@to.nil?
|
||||
if !@from_time.nil? && @to_time.nil?
|
||||
@@ -115,12 +113,7 @@ class HomeController < ApplicationController
|
||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top").sum('i.qty')
|
||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom").sum('i.qty')
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total)
|
||||
# .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)
|
||||
# .sum("(CASE WHEN sp.payment_method='cash' THEN ((sp.payment_amount) - (sales.amount_changed)) ELSE (sp.payment_amount) END)")
|
||||
@employee_sales = []
|
||||
if !employee_sales.nil?
|
||||
employee_sales.each do |emp|
|
||||
@@ -154,7 +147,6 @@ class HomeController < ApplicationController
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time)
|
||||
# @total_other_customer = Sale.total_other_customer(today,current_user)
|
||||
|
||||
@total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time)
|
||||
@@ -172,7 +164,7 @@ class HomeController < ApplicationController
|
||||
@total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
# @print_settings = get_precision_delimiter
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@@ -2,7 +2,6 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
|
||||
@display_type = Lookup.find_by_lookup_type("display_type")
|
||||
|
||||
27
app/helpers/precision_helper.rb
Normal file
27
app/helpers/precision_helper.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
#PrecisionHelper
|
||||
module PrecisionHelper
|
||||
|
||||
def get_precision_delimiter
|
||||
value_set = nil
|
||||
|
||||
setting = PrintSetting.find_by_unique_code("CloseCashierPdf")
|
||||
if setting.nil?
|
||||
star_setting = PrintSetting.find_by_unique_code("CloseCashierStarPdf")
|
||||
if star_setting.nil?
|
||||
value_set = PrintSetting.find_by_unique_code("CloseCashierCustomisePdf")
|
||||
else
|
||||
value_set = star_setting
|
||||
end
|
||||
else
|
||||
value_set = setting
|
||||
end
|
||||
|
||||
if !value_set.nil?
|
||||
@precision_value = value_set.precision.to_i > 0 ? value_set.precision : 0
|
||||
@delimiter_value = value_set.delimiter ? "," : ""
|
||||
end
|
||||
|
||||
return @precision_value, @delimiter_value
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1589,9 +1589,10 @@ end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if current_user.nil?
|
||||
puts "Run employee "
|
||||
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',today,today)
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor'
|
||||
@@ -1602,7 +1603,7 @@ end
|
||||
total = query.where('DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',today,today,shift.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
7
app/views/api/shops/index.json.jbuilder
Normal file
7
app/views/api/shops/index.json.jbuilder
Normal file
@@ -0,0 +1,7 @@
|
||||
if @shops
|
||||
json.status true
|
||||
json.data @shops
|
||||
else
|
||||
json.status false
|
||||
json.message "Record Not Found"
|
||||
end
|
||||
@@ -3,18 +3,6 @@
|
||||
<!-- <h2><%= t :dashboard %></h2> -->
|
||||
<h2><%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></h2>
|
||||
</div>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 col-mbl-view">
|
||||
@@ -211,19 +199,19 @@
|
||||
<tr>
|
||||
<% revenue = @summ_sale.total_amount - @summ_sale.total_discount%>
|
||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||
<td align="right"><%= number_with_precision( revenue, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_with_precision( revenue, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total_sale") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: @precision.to_i ,delimiter: @delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
@@ -240,7 +228,7 @@
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= number_with_precision(data[""+pay_mth+""], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<%= number_with_precision(data[""+pay_mth+""], precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,7 +241,7 @@
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||
<td align="right">
|
||||
<%= number_with_precision(total_card["card"], precision: precision.to_i ,delimiter: delimiter) rescue number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
|
||||
<%= number_with_precision(total_card["card"], precision: @precision.to_i ,delimiter: @delimiter) rescue number_with_precision(0, precision: @precision.to_i ,delimiter: @delimiter) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -21,11 +21,11 @@ class ActionController::Base
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
# if check_license
|
||||
# current_license(ENV["SX_PROVISION_URL"])
|
||||
# else
|
||||
# redirect_to activate_path
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
directory application_path
|
||||
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
environment "production"
|
||||
pidfile "#{application_path}/tmp/puma/pid"
|
||||
state_path "#{application_path}/tmp/puma/state"
|
||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
port ENV.fetch("PORT") { 62158 }
|
||||
workers 2
|
||||
preload_app!
|
||||
threads 1,1
|
||||
# application_path="#{File.expand_path("../..", __FILE__)}"
|
||||
# directory application_path
|
||||
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
||||
# environment "production"
|
||||
# pidfile "#{application_path}/tmp/puma/pid"
|
||||
# state_path "#{application_path}/tmp/puma/state"
|
||||
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||
# port ENV.fetch("PORT") { 62158 }
|
||||
# workers 2
|
||||
# preload_app!
|
||||
# threads 1,1
|
||||
|
||||
@@ -44,6 +44,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
post 'authenticate' => "authenticate#create"
|
||||
delete 'authenticate' => "authenticate#destroy"
|
||||
|
||||
get 'get_shops' => "shops#index"
|
||||
namespace :restaurant do
|
||||
get 'zones' => "zones#index"
|
||||
resources :menu, only: [:index, :show]
|
||||
|
||||
Reference in New Issue
Block a user