merge with staging
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -62,6 +62,9 @@ gem 'jbuilder', '~> 2.5'
|
|||||||
# Use ActiveModel has_secure_password
|
# Use ActiveModel has_secure_password
|
||||||
gem 'bcrypt', '~> 3.1.7'
|
gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
|
# Crypto
|
||||||
|
gem 'aescrypt'
|
||||||
|
|
||||||
gem 'sidekiq'
|
gem 'sidekiq'
|
||||||
gem 'whenever', :require => false
|
gem 'whenever', :require => false
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ GEM
|
|||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
|
aescrypt (1.0.0)
|
||||||
arel (8.0.0)
|
arel (8.0.0)
|
||||||
autoprefixer-rails (7.1.1.2)
|
autoprefixer-rails (7.1.1.2)
|
||||||
execjs
|
execjs
|
||||||
@@ -257,6 +258,7 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
aescrypt
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
bootstrap (~> 4.0.0.alpha3)
|
bootstrap (~> 4.0.0.alpha3)
|
||||||
bootstrap-datepicker-rails
|
bootstrap-datepicker-rails
|
||||||
|
|||||||
@@ -52,3 +52,5 @@ function export_to(path)
|
|||||||
var form_params = $("#frm_report").serialize();
|
var form_params = $("#frm_report").serialize();
|
||||||
window.location = path+"?"+ form_params;
|
window.location = path+"?"+ form_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
app/assets/javascripts/popper.min.js
vendored
Normal file
5
app/assets/javascripts/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#wrapper.toggled {
|
#wrapper.toggled {
|
||||||
padding-left: 200px;
|
padding-left: 210px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-wrapper {
|
#sidebar-wrapper {
|
||||||
@@ -41,13 +41,14 @@
|
|||||||
#page-content-wrapper {
|
#page-content-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
padding: 0px;
|
padding-top: 20px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#wrapper.toggled #page-content-wrapper {
|
#wrapper.toggled #page-content-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-right: -200px;
|
margin-right: -200px;
|
||||||
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@
|
|||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
#wrapper.toggled {
|
#wrapper.toggled {
|
||||||
padding-left: 210px;
|
padding-left: 209px;
|
||||||
}
|
}
|
||||||
#sidebar-wrapper {
|
#sidebar-wrapper {
|
||||||
width: 0;
|
width: 0;
|
||||||
@@ -126,12 +127,13 @@
|
|||||||
width: 216px;
|
width: 216px;
|
||||||
}
|
}
|
||||||
#page-content-wrapper {
|
#page-content-wrapper {
|
||||||
padding: 0px;
|
padding-top: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
#wrapper.toggled #page-content-wrapper {
|
#wrapper.toggled #page-content-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.accordion {
|
.accordion {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ class ApplicationController < ActionController::Base
|
|||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
# lookup domain for db from provision
|
||||||
|
before_action :lookup_domain, :set_locale
|
||||||
|
|
||||||
helper_method :current_company,:current_login_employee,:current_user
|
helper_method :current_company,:current_login_employee,:current_user
|
||||||
# alias_method :current_user, :current_login_employee,:current_user
|
# alias_method :current_user, :current_login_employee,:current_user
|
||||||
#this is base api base controller to need to inherit.
|
#this is base api base controller to need to inherit.
|
||||||
@@ -14,6 +17,61 @@ class ApplicationController < ActionController::Base
|
|||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_locale
|
||||||
|
I18n.locale = params[:locale] || I18n.default_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
# RESTful url for localize
|
||||||
|
def default_url_options
|
||||||
|
{ locale: I18n.locale }
|
||||||
|
end
|
||||||
|
|
||||||
|
def lookup_domain
|
||||||
|
if request.subdomain.present? && request.subdomain != "www"
|
||||||
|
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||||
|
if (!@license.nil?)
|
||||||
|
# logger.info "Location - " + @license.name
|
||||||
|
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||||
|
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||||
|
else
|
||||||
|
# reconnect_default_db
|
||||||
|
logger.info 'License is nil'
|
||||||
|
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||||
|
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_license(url, key)
|
||||||
|
@license = License.new(url, key)
|
||||||
|
|
||||||
|
##creating md5 hash
|
||||||
|
md5_hostname = Digest::MD5.new
|
||||||
|
md5key = md5_hostname.update(request.host)
|
||||||
|
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||||
|
#if (@license.detail == true)
|
||||||
|
|
||||||
|
return @license
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def website_connection(license)
|
||||||
|
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||||
|
:username => license.dbusername, :password => license.dbpassword)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def reconnect_default_db
|
||||||
|
ActiveRecord::Base.establish_connection(Rails.env)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Regular database.yml configuration hash
|
||||||
|
def default_connection
|
||||||
|
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||||
|
end
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||||
end
|
end
|
||||||
@@ -40,3 +98,6 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Crm::BookingsController < BaseCrmController
|
class Crm::BookingsController < ApplicationController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
def update_booking
|
def update_booking
|
||||||
booking = Booking.find(params[:booking_id])
|
booking = Booking.find(params[:booking_id])
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Crm::CustomersController < ApplicationController#BaseCrmController
|
class Crm::CustomersController < ApplicationController #BaseCrmController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
|
before_action :set_crm_customer, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Crm::DiningQueuesController < ApplicationController#BaseCrmController
|
class Crm::DiningQueuesController < ApplicationController #BaseCrmController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
|
before_action :set_dining_queue, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Crm::HomeController < BaseCrmController
|
class Crm::HomeController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
|
||||||
@booking = Booking.all
|
@booking = Booking.all
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Oqs::EditController < BaseOqsController
|
class Oqs::EditController < ApplicationController#BaseOqsController
|
||||||
def index
|
def index
|
||||||
assigned_item_id = params[:id]
|
assigned_item_id = params[:id]
|
||||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
if (params[:id])
|
if (params[:id])
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
@menu = MenuCategory.find_by_id(params[:id])
|
@menu = MenuCategory.find_by_id(params[:id])
|
||||||
puts @menu.menu_items[1].item_attributes.to_json
|
# puts @menu.menu_items[1].item_attributes.to_json
|
||||||
return @menu
|
return @menu
|
||||||
else
|
else
|
||||||
MenuCategory.current_menu
|
MenuCategory.current_menu
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
class Origami::CardPaymentsController < ApplicationController#BaseOrigamiController
|
class Origami::CardPaymentsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@membership_rebate_balance = 0
|
@membership_rebate_balance = 0
|
||||||
@membership_id = 0
|
@membership_id = 0
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::CashInsController < ApplicationController#BaseOrigamiController
|
class Origami::CashInsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::CashOutsController < ApplicationController#BaseOrigamiController
|
class Origami::CashOutsController < ApplicationController#BaseOrigamiController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
class Origami::CreditPaymentsController < ApplicationController#BaseOrigamiController
|
class Origami::CreditPaymentsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::CustomersController < ApplicationController#BaseOrigamiController
|
class Origami::CustomersController < ApplicationController #BaseOrigamiController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::DiscountsController < ApplicationController#BaseOrigamiController
|
class Origami::DiscountsController < ApplicationController #BaseOrigamiController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
#discount page show from origami index with selected order
|
#discount page show from origami index with selected order
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::HomeController < ApplicationController#BaseOrigamiController
|
class Origami::HomeController < ApplicationController #BaseOrigamiController
|
||||||
before_action :set_dining, only: [:show]
|
before_action :set_dining, only: [:show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::HomeController < BaseOrigamiController
|
class Origami::HomeController < ApplicationController
|
||||||
def index
|
def index
|
||||||
if params[:booking_id] != nil
|
if params[:booking_id] != nil
|
||||||
type=params[:booking_id].split('-')[0];
|
type=params[:booking_id].split('-')[0];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::InDutiesController < ApplicationController#BaseOrigamiController
|
class Origami::InDutiesController < ApplicationController #BaseOrigamiController
|
||||||
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
||||||
|
|
||||||
# GET /in_duties
|
# GET /in_duties
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::JcbController < ApplicationController#BaseOrigamiController
|
class Origami::JcbController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::MasterController < ApplicationController#BaseOrigamiController
|
class Origami::MasterController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Origami::MoveroomController < ApplicationController#BaseOrigamiController
|
class Origami::MoveroomController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def move_dining
|
def move_dining
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Origami::MovetableController < ApplicationController#BaseOrigamiController
|
class Origami::MovetableController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def move_dining
|
def move_dining
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::MpuController < ApplicationController#BaseOrigamiController
|
class Origami::MpuController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::OrdersController < ApplicationController#BaseOrigamiController
|
class Origami::OrdersController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::OtherChargesController < ApplicationController#BaseOrigamiController
|
class Origami::OtherChargesController < ApplicationController #BaseOrigamiController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
class Origami::OthersPaymentsController < ApplicationController#BaseOrigamiController
|
class Origami::OthersPaymentsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@membership_rebate_balance = 0
|
@membership_rebate_balance = 0
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::PaymentsController < ApplicationController#BaseOrigamiController
|
class Origami::PaymentsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::ProductCommissionsController < ApplicationController#BaseOrigamiController
|
class Origami::ProductCommissionsController < ApplicationController #BaseOrigamiController
|
||||||
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
|
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
# GET /product_commissions
|
# GET /product_commissions
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::RedeemPaymentsController < ApplicationController#BaseOrigamiController
|
class Origami::RedeemPaymentsController < ApplicationController #BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
payment_method = params[:payment_method]
|
payment_method = params[:payment_method]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::RequestBillsController < BaseOrigamiController
|
class Origami::RequestBillsController < ApplicationController
|
||||||
|
|
||||||
# Print Request Bill and add to sale tables
|
# Print Request Bill and add to sale tables
|
||||||
def print
|
def print
|
||||||
@@ -24,6 +24,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
# Bind shift sale id to sale
|
# Bind shift sale id to sale
|
||||||
@sale_data.shift_sale_id = shift.id
|
@sale_data.shift_sale_id = shift.id
|
||||||
@sale_data.save
|
@sale_data.save
|
||||||
|
|
||||||
|
# Promotion Activation
|
||||||
|
Promotion.promo_activate(@sale)
|
||||||
else
|
else
|
||||||
@status = false
|
@status = false
|
||||||
@error_message = "No Current Open Shift for This Employee"
|
@error_message = "No Current Open Shift for This Employee"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::RoomInvoicesController < ApplicationController#BaseOrigamiController
|
class Origami::RoomInvoicesController < ApplicationController #BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
@room = DiningFacility.find(params[:room_id])
|
@room = DiningFacility.find(params[:room_id])
|
||||||
puts "room bookig lenght"
|
puts "room bookig lenght"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::RoomsController < ApplicationController#BaseOrigamiController
|
class Origami::RoomsController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::SaleEditController < ApplicationController#BaseOrigamiController
|
class Origami::SaleEditController < ApplicationController #BaseOrigamiController
|
||||||
authorize_resource class: false
|
authorize_resource class: false
|
||||||
# Index for sale item void OR edit
|
# Index for sale item void OR edit
|
||||||
def edit
|
def edit
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::SalesController < ApplicationController#BaseOrigamiController
|
class Origami::SalesController < ApplicationController#BaseOrigamiController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::ShiftsController < ApplicationController#BaseOrigamiController
|
class Origami::ShiftsController < ApplicationController#BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::TableInvoicesController < ApplicationController#BaseOrigamiController
|
class Origami::TableInvoicesController < ApplicationController #BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
@table = DiningFacility.find(params[:table_id])
|
@table = DiningFacility.find(params[:table_id])
|
||||||
puts "table bookig lenght"
|
puts "table bookig lenght"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::VisaController < ApplicationController#BaseOrigamiController
|
class Origami::VisaController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Origami::VoidController < BaseOrigamiController
|
class Origami::VoidController < ApplicationController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def overall_void
|
def overall_void
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class Origami::VoucherController < ApplicationController#BaseOrigamiController
|
class Origami::VoucherController < ApplicationController #BaseOrigamiController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def print_setting_params
|
def print_setting_params
|
||||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
192
app/models/license.rb
Executable file
192
app/models/license.rb
Executable file
@@ -0,0 +1,192 @@
|
|||||||
|
class License
|
||||||
|
include HTTParty
|
||||||
|
|
||||||
|
base_uri "secure.smartsales.asia/api"
|
||||||
|
|
||||||
|
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
||||||
|
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
||||||
|
:dbhost, :dbschema, :dbusername, :dbpassword, :exchange_unqiue_id, :localqueue_host,:server_mode,:localhost_address,
|
||||||
|
:localqueue_user, :localqueue_password, :remotequeue_host, :remotequeue_user, :remotequeue_password, :api_token, :app_token
|
||||||
|
|
||||||
|
@license = nil
|
||||||
|
@secret = nil
|
||||||
|
|
||||||
|
def initialize(server = "", lookup = "")
|
||||||
|
#this code is hard-code to reflect server mode - Very important.
|
||||||
|
self.server_mode = "cloud"
|
||||||
|
|
||||||
|
if (server != "")
|
||||||
|
self.class.base_uri server
|
||||||
|
end
|
||||||
|
|
||||||
|
@secret = SecureRandom.hex(10)
|
||||||
|
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key'] } }
|
||||||
|
end
|
||||||
|
|
||||||
|
def shop_code
|
||||||
|
if ( self.subdomain.length > 3)
|
||||||
|
return self.subdomain[0,3].upcase
|
||||||
|
else
|
||||||
|
return self.subdomain.upcase
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def detail_with_local_cache(lookup, key)
|
||||||
|
##Check from local redis - if available load local otherwise get from remote
|
||||||
|
cache_key = "store:license:#{key}:hostname"
|
||||||
|
|
||||||
|
# No Needs for current
|
||||||
|
# @secret = key
|
||||||
|
|
||||||
|
cache_license = nil
|
||||||
|
|
||||||
|
##Get redis connection from connection pool
|
||||||
|
Redis.current do |conn|
|
||||||
|
cache_license = conn.get(cache_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||||
|
|
||||||
|
if cache_license.nil?
|
||||||
|
##change the d/e key
|
||||||
|
# @options = { query: {device: "SXlite", lookup: lookup, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||||
|
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['provision_key']} }
|
||||||
|
|
||||||
|
response = self.class.get("/request_license", @params)
|
||||||
|
@license = response.parsed_response
|
||||||
|
|
||||||
|
if (@license["status"] == true)
|
||||||
|
|
||||||
|
assign()
|
||||||
|
|
||||||
|
Rails.logger.info "License - " + response.parsed_response.to_s
|
||||||
|
|
||||||
|
Redis.current do |conn|
|
||||||
|
##Remote - store the remote response in local redis cache
|
||||||
|
conn.set(cache_key, Marshal.dump(@license))
|
||||||
|
##ADD to List to remove later
|
||||||
|
conn.sadd("License:cache:keys", cache_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
Rails.logger.info 'API License'
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
@license = Marshal.load(cache_license) if cache_license
|
||||||
|
|
||||||
|
Rails.logger.info 'Cache License'
|
||||||
|
|
||||||
|
if (@license["status"] == true)
|
||||||
|
assign()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
def detail
|
||||||
|
|
||||||
|
response = self.class.get("/subdomain", @options)
|
||||||
|
@license = response.parsed_response
|
||||||
|
|
||||||
|
Rails.logger.debug "License - " + response.parsed_response.to_s
|
||||||
|
|
||||||
|
|
||||||
|
if (@license["status"] == true)
|
||||||
|
assign()
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_remote_license(license_key)
|
||||||
|
# @options = { query: {device: "cloud", key: license_key, skey: @secret, token: Rails.application.secrets.provision_key} }
|
||||||
|
@options = { query: {device: "SXlite", key: license_key, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||||
|
response = self.class.get("/license", @options)
|
||||||
|
|
||||||
|
@license = response.parsed_response
|
||||||
|
|
||||||
|
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||||
|
if (@license["status"])
|
||||||
|
assign()
|
||||||
|
end
|
||||||
|
return @license["status"]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def verify_by_api_token(api_token)
|
||||||
|
@options = { query: {device: "SXlite", api_token: api_token, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||||
|
response = self.class.get("/verify", @options)
|
||||||
|
|
||||||
|
@license = response.parsed_response
|
||||||
|
|
||||||
|
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||||
|
if (@license["status"])
|
||||||
|
assign()
|
||||||
|
end
|
||||||
|
|
||||||
|
return @license["status"]
|
||||||
|
end
|
||||||
|
#Load License is remove from the cloud license because - this license is must be validated against subdmain instead of license.data from file.
|
||||||
|
|
||||||
|
|
||||||
|
def expired?
|
||||||
|
if (self.plan_next_renewal_date < Date.today)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def assign
|
||||||
|
# self.name = @license["name"]
|
||||||
|
# self.address_1 = @license["address_1"]
|
||||||
|
# self.address_2 = @license["address_2"]
|
||||||
|
# self.township = @license["township"]
|
||||||
|
# self.city = @license["city"]
|
||||||
|
# self.country = @license["country"]
|
||||||
|
# self.email = @license["email"]
|
||||||
|
# self.phone = @license["phone"]
|
||||||
|
# self.fax = @license["fax"]
|
||||||
|
# self.logo = @license["logo"]
|
||||||
|
# self.localhost_address = @license["localhost_address"]
|
||||||
|
# self.subdomain = @license["subdomain"]
|
||||||
|
# self.plan_activation_date = Date.parse(@license["plan_activation_date"])
|
||||||
|
# self.plan_next_renewal_date = Date.parse(@license["plan_next_renewal_date"])
|
||||||
|
|
||||||
|
## self.plan_activation_date = Date.strptime(@license["plan_activation_date"], "%Y-%m-%d")
|
||||||
|
## self.plan_next_renewal_date = Date.strptime(@license["plan_next_renewal_date"], "%Y-%m-%d")
|
||||||
|
|
||||||
|
|
||||||
|
# self.plan_max_products = @license["plan_max_products"].to_i
|
||||||
|
# self.plan_max_customers = @license["plan_max_customers"].to_i
|
||||||
|
# self.plan_active_connections = @license["plan_active_connections"].to_i
|
||||||
|
salt = @license["secret_key"]
|
||||||
|
|
||||||
|
if (@license["dbhost"] || @license["dbschema"] || @license["dbusername"] || @license["dbpassword"] )
|
||||||
|
self.dbhost = AESCrypt.decrypt(@license["dbhost"], salt)
|
||||||
|
self.dbschema = AESCrypt.decrypt(@license["dbschema"], salt)
|
||||||
|
self.dbusername = AESCrypt.decrypt(@license["dbusername"], salt)
|
||||||
|
self.dbpassword = AESCrypt.decrypt(@license["dbpassword"], salt)
|
||||||
|
end
|
||||||
|
|
||||||
|
# self.exchange_unqiue_id = @license["exchange_unqiue_id"]
|
||||||
|
|
||||||
|
# self.localqueue_host= @license["localqueue_host"]
|
||||||
|
# self.localqueue_user= @license["localqueue_user"]
|
||||||
|
# self.localqueue_password= @license["localqueue_password"]
|
||||||
|
|
||||||
|
# self.remotequeue_host = @license["remotequeue_host"]
|
||||||
|
# self.remotequeue_user = @license["remotequeue_user"]
|
||||||
|
# self.remotequeue_password = @license["remotequeue_password"]
|
||||||
|
|
||||||
|
# self.api_token = @license["api_token"]
|
||||||
|
# self.app_token = @license["app_token"]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -21,7 +21,18 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ class CrmOrderPdf < Prawn::Document
|
|||||||
@half_qty = @qty_width / 2
|
@half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 9
|
self.item_font_size = 9
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,18 @@ class OrderItemPdf < Prawn::Document
|
|||||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if print_settings.font != nil
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
#font "public/fonts/Chinese.ttf"
|
#font "public/fonts/Chinese.ttf"
|
||||||
|
|||||||
@@ -15,9 +15,20 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if print_settings.font != nil
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ class QueueNoPdf < Prawn::Document
|
|||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,18 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
@@ -226,7 +237,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width) do
|
||||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
@@ -453,8 +464,8 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width =>self.label_width) do
|
||||||
text "#{printed_status}",:style => :bold, :size => self.header_font_size,:align => :left
|
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||||
|
|||||||
@@ -21,7 +21,19 @@ class StockResultPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
|
|||||||
@@ -101,6 +101,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
<div class="col-lg-4 col-md-4 col-sm-4" style="min-height:600px; max-height:600px; overflow-x:scroll">
|
||||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||||
|
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<br>
|
||||||
|
<a href="<%= dashboard_path%>" class="btn btn-primary">
|
||||||
|
Back
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
<!-- <div class="col-lg-1 col-md-1 col-sm-1 ">
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -71,9 +71,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading"><h4>Hourly Sales</h4></div>
|
<div class="panel-heading"><h4>Hourly Sales</h4></div>
|
||||||
@@ -90,28 +90,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="footer" style="background-color: inherit">
|
<!-- <script src="js/Chart.js"></script> -->
|
||||||
<div class="card">
|
|
||||||
<div class="page-header center-text">
|
|
||||||
<h4 class="footer-header">
|
|
||||||
<%= @shop.name %>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
<div class="center-text">
|
|
||||||
<%= @shop.address %>
|
|
||||||
</div>
|
|
||||||
<div class="center-text">
|
|
||||||
<%= @shop.phone_no %>
|
|
||||||
</div>
|
|
||||||
>>>>>>> chart
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<script src="js/Chart.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var top_products = JSON.parse('<%= @top_products.to_json.html_safe %>');
|
var top_products = JSON.parse('<%= @top_products.to_json.html_safe %>');
|
||||||
|
|||||||
@@ -148,12 +148,13 @@
|
|||||||
console.log($(this).data("formid"));
|
console.log($(this).data("formid"));
|
||||||
var item = $(this).data("formid");
|
var item = $(this).data("formid");
|
||||||
$(item).submit();
|
$(item).submit();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add minus icon for collapse element which is open by default
|
// Add minus icon for collapse element which is open by default
|
||||||
$(".collapse.in").each(function () {
|
$(".collapse.in").each(function () {
|
||||||
$(this).siblings(".panel-heading").find(".glyphicon").addClass("glyphicon-minus").removeClass("glyphicon-plus");
|
$(this).siblings(".panel-heading").find(".glyphicon").addClass("glyphicon-minus").removeClass("glyphicon-plus");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle plus minus icon on show hide of collapse element
|
// Toggle plus minus icon on show hide of collapse element
|
||||||
$(".collapse").on('show.bs.collapse', function () {
|
$(".collapse").on('show.bs.collapse', function () {
|
||||||
$(this).parent().find(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
|
$(this).parent().find(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
|
||||||
|
|||||||
@@ -39,18 +39,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).on('turbolinks:load', function () {
|
$(document).ready(function() {
|
||||||
$(".pin_pad").click(function (event) {
|
$(".pin_pad").click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log($(this).data("value"));
|
var old_value = $("#login_form_password").val();
|
||||||
var value = $(this).data("value");
|
var value = $(this).data("value");
|
||||||
|
console.log(old_value);
|
||||||
|
console.log(value);
|
||||||
if (value == "CLR") {
|
if (value == "CLR") {
|
||||||
$("#login_form_password").val("");
|
$("#login_form_password").val("");
|
||||||
} else if (value == "ENT") {
|
} else if (value == "ENT") {
|
||||||
$("#new_login_form").submit();
|
$("#new_login_form").submit();
|
||||||
} else {
|
} else {
|
||||||
var old_value = $("#login_form_password").val();
|
|
||||||
$("#login_form_password").val(old_value + value);
|
$("#login_form_password").val(old_value + value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<%= render 'layouts/header_oqs' %>
|
<%= render 'layouts/header' %>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<% flash.each do |type, message| %>
|
<% flash.each do |type, message| %>
|
||||||
<div class="alert fade in">
|
<div class="alert fade in">
|
||||||
|
|||||||
@@ -31,8 +31,11 @@
|
|||||||
<!-- <a href="<%= logout_path %>"><i class="material-icons">input</i>Sign Out</a> -->
|
<!-- <a href="<%= logout_path %>"><i class="material-icons">input</i>Sign Out</a> -->
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="javascript:void(0);" class="js-right-sidebar" data-close="true"><i class="material-icons">more_vert</i></a>
|
<a href="javascript:void(0);" class="js-right-sidebar" data-close="true">
|
||||||
|
<i class="material-icons">more_vert</i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<!-- #Top Bar
|
<!-- #Top Bar
|
||||||
|
|
||||||
|
|||||||
36
app/views/layouts/_sidebar.html.erb
Normal file
36
app/views/layouts/_sidebar.html.erb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<div id="sidebar-wrapper">
|
||||||
|
<ul id="accordion" class="accordion sidebar-nav">
|
||||||
|
<li class="header"><a>Main Navigation</a></li>
|
||||||
|
<li><%= link_to "Dashboard ", dashboard_path,:class =>"" %> </li>
|
||||||
|
<li><%= link_to "OQS ", oqs_root_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Cashier ", origami_root_path,:class =>"" %></li>
|
||||||
|
<li>
|
||||||
|
<div class="link">CRM<i class="fa fa-chevron-down"></i>
|
||||||
|
</div>
|
||||||
|
<ul class="submenu">
|
||||||
|
<li> <%= link_to "Customer ", crm_customers_path,:class =>"" %></li>
|
||||||
|
<li> <%= link_to "Queue ", crm_dining_queues_path,:class =>"" %></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><%= link_to "Inventory ", inventory_path,:class =>"" %></li>
|
||||||
|
<li class="header"><a>Settings</a></li>
|
||||||
|
<li><%= link_to "Zones ", settings_zones_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Order Queue Station ", settings_order_queue_stations_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Menu ", settings_menus_path,:class =>"" %></li>
|
||||||
|
<li>
|
||||||
|
<div class="link">Transactions<i class="fa fa-chevron-down"></i>
|
||||||
|
</div>
|
||||||
|
<ul class="submenu">
|
||||||
|
<li> <%= link_to "Orders ", transactions_orders_path,:class =>"" %></li>
|
||||||
|
<li> <%= link_to "Sales ", transactions_sales_path,:class =>"" %></li>
|
||||||
|
<li> <%= link_to "Credit Note ", transactions_credit_notes_path,:class =>"m" %></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><%= link_to "Cashier Terminal ", settings_cashier_terminals_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Print Settings ", print_settings_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Staff ", settings_employees_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Product ", settings_products_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Promotion ", settings_promotions_path,:class =>"" %></li>
|
||||||
|
<li><%= link_to "Reports", reports_dailysale_index_path, :class =>"" %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
<%= f.input :unique_code %>
|
<%= f.input :unique_code %>
|
||||||
<%= f.input :template %>
|
<%= f.input :template %>
|
||||||
<%= f.input :printer_name %>
|
<%= f.input :printer_name %>
|
||||||
|
<%= f.input :font %>
|
||||||
<%= f.input :api_settings %>
|
<%= f.input :api_settings %>
|
||||||
<%= f.input :page_width %>
|
<%= f.input :page_width %>
|
||||||
<%= f.input :page_height %>
|
<%= f.input :page_height %>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
json.extract! print_setting, :id, :name,, :unique_code,, :template,, :db_name,, :db_type,, :db_username,, :db_password,, :printer_name,, :api_settings,, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
json.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
||||||
json.url print_setting_url(print_setting, format: :json)
|
json.url print_setting_url(print_setting, format: :json)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<th>Unique code</th>
|
<th>Unique code</th>
|
||||||
<th>Template</th>
|
<th>Template</th>
|
||||||
<th>Printer name</th>
|
<th>Printer name</th>
|
||||||
|
<th>Font</th>
|
||||||
<th>Api settings</th>
|
<th>Api settings</th>
|
||||||
<th>Page width</th>
|
<th>Page width</th>
|
||||||
<th>Page height</th>
|
<th>Page height</th>
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
<td><%= print_setting.unique_code %></td>
|
<td><%= print_setting.unique_code %></td>
|
||||||
<td><%= print_setting.template %></td>
|
<td><%= print_setting.template %></td>
|
||||||
<td><%= print_setting.printer_name %></td>
|
<td><%= print_setting.printer_name %></td>
|
||||||
|
<td><%= print_setting.font %></td>
|
||||||
<td><%= print_setting.api_settings %></td>
|
<td><%= print_setting.api_settings %></td>
|
||||||
<td><%= print_setting.page_width %></td>
|
<td><%= print_setting.page_width %></td>
|
||||||
<td><%= print_setting.page_height %></td>
|
<td><%= print_setting.page_height %></td>
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Printer name</th>
|
<th>Printer name</th>
|
||||||
<td><%= @print_setting.printer_name %></td>
|
<td><%= @print_setting.printer_name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Font</th>
|
||||||
|
<td><%= @print_setting.font %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Api settings</th>
|
<th>Api settings</th>
|
||||||
|
|||||||
@@ -1,42 +1,39 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
||||||
<label class="">Select Date Range</label>
|
<% if period_type != false %>
|
||||||
<% if @daterange %>
|
<div class="row">
|
||||||
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
|
||||||
<% else %>
|
<div class="form-group col-md-3">
|
||||||
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
<label class="">Select Date Range</label>
|
||||||
<% end %>
|
<% if @daterange %>
|
||||||
</div>
|
<input class="form-control" name="daterange" id="daterange" value="<%= @daterange %>" type="text" placeholder="Date Range" readonly="true">
|
||||||
<div class="form-group col-md-3">
|
<% else %>
|
||||||
<label class="">Commissioner</label>
|
<input class="form-control" name="daterange" id="daterange" type="text" placeholder="Date Range" readonly="true">
|
||||||
<select class="form-control" name="commissioner" id="commissioner">
|
<% end %>
|
||||||
<option value=""></option>
|
</div>
|
||||||
<% @commissioner.each do |c| %>
|
<div class="form-group col-md-3">
|
||||||
<% if @com_id == c.id %>
|
<label class="">Commissioner</label>
|
||||||
<option value="<%= c.id %>" selected><%= c.name %></option>
|
<select class="form-control" name="commissioner" id="commissioner">
|
||||||
<% else %>
|
<option value=""></option>
|
||||||
<option value="<%= c.id %>"><%= c.name %></option>
|
<% @commissioner.each do |c| %>
|
||||||
<% end %> %>
|
<% if @com_id == c.id %>
|
||||||
<% end %>
|
<option value="<%= c.id %>" selected><%= c.name %></option>
|
||||||
</select>
|
<% else %>
|
||||||
</div>
|
<option value="<%= c.id %>"><%= c.name %></option>
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
<% end %> %>
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</select>
|
||||||
<% end %>
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
@@ -5,23 +7,23 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial => 'commission_report_filter',
|
<%= render :partial => 'commission_report_filter',
|
||||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %>
|
:locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %>
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%= reports_commission_index_path %>.xls')" class="btn btn-default">Export to
|
<a href="javascript:export_to('<%= reports_commission_index_path %>.xls')" class="btn btn-default">Export to
|
||||||
Excel</a>
|
Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card row">
|
<div class="card">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -1,125 +1,121 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="">Select Period</option>
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">All Shift</label>
|
|
||||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-1 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
|
<% if period_type != false %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label>Select Period</label>
|
||||||
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<option value="">Select Period</option>
|
||||||
|
<option value="0">Today</option>
|
||||||
|
<option value="1">Yesterday</option>
|
||||||
|
<option value="2">This week</option>
|
||||||
|
<option value="3">Last week</option>
|
||||||
|
<option value="4">Last 7 days</option>
|
||||||
|
<option value="5">This month</option>
|
||||||
|
<option value="6">Last month</option>
|
||||||
|
<option value="7">Last 30 days</option>
|
||||||
|
<option value="8">This year</option>
|
||||||
|
<option value="9">Last year</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
|
<label class="">From</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label class="">To</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">All Shift</label>
|
||||||
|
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-1 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
$('#custom_excel').click(function(){
|
||||||
var url = $('#custom_excel').attr('data-url');
|
var url = $('#custom_excel').attr('data-url');
|
||||||
$('#frm_report').attr('action',url)
|
$('#frm_report').attr('action',url)
|
||||||
$('#frm_report').submit();
|
$('#frm_report').submit();
|
||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'order'){
|
if(item == 'order'){
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(item == 'sale'){
|
else if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
$("#item").val('sale');
|
$("#item").val('sale');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<% if params[:shift_name].to_i > 0%>
|
<% if params[:shift_name].to_i > 0%>
|
||||||
shift_id = '<%= params[:shift_name] %>'
|
shift_id = '<%= params[:shift_name] %>'
|
||||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||||
shift.append(str);
|
shift.append(str);
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||||
// shift = $(".shift-id").text()
|
// shift = $(".shift-id").text()
|
||||||
// if (shift.length>0) {
|
// if (shift.length>0) {
|
||||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
$("#rd_period_type_1").attr("checked","checked");
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#rd_period_type_0").attr("checked","checked");
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
<% end %>
|
<% end %>
|
||||||
$(".btn-group button").removeClass("active");
|
$(".btn-group button").removeClass("active");
|
||||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
$('#item').change(function(){
|
$('#item').change(function(){
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'sale'){
|
if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').show();
|
$('#payment_type').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,22 +5,22 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
|
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_credit_payment_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%=reports_credit_payment_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_credit_payment_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card row">
|
<div class="card ">
|
||||||
<% unless @sale_data.blank? %>
|
<% unless @sale_data.blank? %>
|
||||||
|
|
||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
|
|||||||
@@ -1,144 +1,122 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="">Select Period</option>
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<% if defined? show_monthly %>
|
|
||||||
<div class="span3" style="margin-bottom:10px;">
|
|
||||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
|
||||||
<div class="btn-group" data-toggle="buttons-radio">
|
|
||||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
|
||||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group">
|
|
||||||
<% if defined? promotions %>
|
|
||||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? menu_types %>
|
|
||||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? payments %>
|
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? shift_name %>
|
|
||||||
<!-- Temporary no needs
|
|
||||||
<select name="shift_name" id="shift_name"></select>
|
|
||||||
-->
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? cashiers %>
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
<% if period_type != false %>
|
||||||
<% end %>
|
<div class="row">
|
||||||
|
<div class="form-group col-md-2">
|
||||||
<% if defined? singer %>
|
<label>Select Period</label>
|
||||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
<select name="period" id="sel_period" class="form-control">
|
||||||
<% end %>
|
<option value="">Select Period</option>
|
||||||
|
<option value="0">Today</option>
|
||||||
<% if defined? bsm %>
|
<option value="1">Yesterday</option>
|
||||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
<option value="2">This week</option>
|
||||||
<% end %>
|
<option value="3">Last week</option>
|
||||||
|
<option value="4">Last 7 days</option>
|
||||||
<% if defined? guest_role %>
|
<option value="5">This month</option>
|
||||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
<option value="6">Last month</option>
|
||||||
<% end %>
|
<option value="7">Last 30 days</option>
|
||||||
|
<option value="8">This year</option>
|
||||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
<option value="9">Last year</option>
|
||||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
</select>
|
||||||
<% end %>
|
</div>
|
||||||
|
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
||||||
<% if defined? products %>
|
|
||||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? items %>
|
<div class="form-group col-md-3">
|
||||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
<% end %>
|
<label class="">From</label>
|
||||||
</div>
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">To</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<!-- <div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="form-group">
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
<% if defined? promotions %>
|
||||||
</div>
|
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
||||||
</div> -->
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? menu_types %>
|
||||||
|
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? payments %>
|
||||||
|
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? shift_name %>
|
||||||
|
<!-- Temporary no needs
|
||||||
|
<select name="shift_name" id="shift_name"></select> -->
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? cashiers %>
|
||||||
|
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? singer %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? bsm %>
|
||||||
|
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
<% if defined? guest_role %>
|
||||||
|
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
||||||
|
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? products %>
|
||||||
|
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if defined? items %>
|
||||||
|
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
$('#custom_excel').click(function(){
|
||||||
var url = $('#custom_excel').attr('data-url');
|
var url = $('#custom_excel').attr('data-url');
|
||||||
$('#frm_report').attr('action',url)
|
$('#frm_report').attr('action',url)
|
||||||
$('#frm_report').submit();
|
$('#frm_report').submit();
|
||||||
// window.location = url;
|
|
||||||
|
});
|
||||||
|
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'order'){
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
$("#item").val('sale');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var item = $('#item').val();
|
|
||||||
var payment_type = $('#payment_type');
|
|
||||||
|
|
||||||
if(item == 'order'){
|
|
||||||
$('#cashier').hide();
|
|
||||||
$('#waiter').show();
|
|
||||||
if(payment_type){
|
|
||||||
$('#payment_type').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(item == 'sale'){
|
|
||||||
$('#waiter').hide();
|
|
||||||
$('#cashier').show();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('#waiter').hide();
|
|
||||||
$('#cashier').show();
|
|
||||||
$("#item").val('sale');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//Reset the form to pervious values
|
//Reset the form to pervious values
|
||||||
$("#branch").val(<%=params[:branch]%>);
|
$("#branch").val(<%=params[:branch]%>);
|
||||||
@@ -156,9 +134,9 @@ $("#sel_period").val(<%=params[:period]%>);
|
|||||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
$("#rd_period_type_1").attr("checked","checked");
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#rd_period_type_0").attr("checked","checked");
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
<% end %>
|
<% end %>
|
||||||
$(".btn-group button").removeClass("active");
|
$(".btn-group button").removeClass("active");
|
||||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
|
|||||||
@@ -1,139 +1,152 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<div class="col-md-12">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<div class="row">
|
||||||
<li>Daily Sale Report</li>
|
<div class="page-header col-md-12 col-lg-12">
|
||||||
</ul>
|
<ul class="breadcrumb">
|
||||||
</div>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
|
<li>Daily Sale Report</li>
|
||||||
<div class="container">
|
</ul>
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
</div>
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-right">
|
|
||||||
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th style='text-align:center;'>Sr</th>
|
|
||||||
<th style='text-align:center;'>Date</th>
|
|
||||||
<th style='text-align:center;'>Void Amount</th>
|
|
||||||
<th style='text-align:center;'>Mpu Sales</th>
|
|
||||||
<th style='text-align:center;'>Master Sales</th>
|
|
||||||
<th style='text-align:center;'>Visa Sales</th>
|
|
||||||
<th style='text-align:center;'>Jcb Sales</th>
|
|
||||||
<th style='text-align:center;'>Redeem Sales</th>
|
|
||||||
<th style='text-align:center;'>Cash Sales</th>
|
|
||||||
<th style='text-align:center;'>Credit Sales</th>
|
|
||||||
<th style='text-align:center;'>FOC Sales</th>
|
|
||||||
<th style='text-align:center;'>(Discount)</th>
|
|
||||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Grand Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% unless @sale_data.empty? %>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% void = 0 %>
|
|
||||||
<% mpu = 0 %>
|
|
||||||
<% master = 0 %>
|
|
||||||
<% visa = 0 %>
|
|
||||||
<% jcb = 0 %>
|
|
||||||
<% paypar = 0 %>
|
|
||||||
<% cash = 0 %>
|
|
||||||
<% credit = 0 %>
|
|
||||||
<% foc = 0 %>
|
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% grand_total = 0 %>
|
|
||||||
<% old_grand_total = 0 %>
|
|
||||||
<% count = 1 %> <% rounding_adj = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% void += sale[:void_amount] %>
|
|
||||||
<% mpu += sale[:mpu_amount] %>
|
|
||||||
<% master += sale[:master_amount] %>
|
|
||||||
<% visa += sale[:visa_amount] %>
|
|
||||||
<% jcb += sale[:jcb_amount] %>
|
|
||||||
<% paypar += sale[:paypar_amount] %>
|
|
||||||
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
|
||||||
<% credit += sale[:credit_amount] %>
|
|
||||||
<% foc += sale[:foc_amount] %>
|
|
||||||
<% discount += sale[:total_discount] %>
|
|
||||||
<% total += sale[:old_grand_total].to_f + sale[:rounding_adj].to_f %>
|
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
|
||||||
<% old_grand_total += sale[:old_grand_total].to_f %>
|
|
||||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:right;'><%= count %></td>
|
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:old_grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:old_grand_total]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",old_grand_total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% total_tax = 0 %>
|
|
||||||
<% unless @tax.empty? %>
|
|
||||||
<% @tax.each do |tax| %>
|
|
||||||
<% total_tax += tax.tax_amount.to_f %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<% net = total - total_tax %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="row">
|
||||||
|
<div class="col-md-12 col-lg-12"> -->
|
||||||
|
<!-- <div class="container"> -->
|
||||||
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||||
|
<hr />
|
||||||
|
<!-- </div> -->
|
||||||
|
<!-- </div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<!-- <div class="row"> -->
|
||||||
|
<!-- <div class="container"> -->
|
||||||
|
<div class=" text-right">
|
||||||
|
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 col-lg-12">
|
||||||
|
<div class="card ">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="15"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th style='text-align:center;'>Sr</th>
|
||||||
|
<th style='text-align:center;'>Date</th>
|
||||||
|
<th style='text-align:center;'>Void Amount</th>
|
||||||
|
<th style='text-align:center;'>Mpu Sales</th>
|
||||||
|
<th style='text-align:center;'>Master Sales</th>
|
||||||
|
<th style='text-align:center;'>Visa Sales</th>
|
||||||
|
<th style='text-align:center;'>Jcb Sales</th>
|
||||||
|
<th style='text-align:center;'>Redeem Sales</th>
|
||||||
|
<th style='text-align:center;'>Cash Sales</th>
|
||||||
|
<th style='text-align:center;'>Credit Sales</th>
|
||||||
|
<th style='text-align:center;'>FOC Sales</th>
|
||||||
|
<th style='text-align:center;'>(Discount)</th>
|
||||||
|
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Rounding Adj.</th>
|
||||||
|
<th style='text-align:center;'>Grand Total</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% unless @sale_data.empty? %>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% void = 0 %>
|
||||||
|
<% mpu = 0 %>
|
||||||
|
<% master = 0 %>
|
||||||
|
<% visa = 0 %>
|
||||||
|
<% jcb = 0 %>
|
||||||
|
<% paypar = 0 %>
|
||||||
|
<% cash = 0 %>
|
||||||
|
<% credit = 0 %>
|
||||||
|
<% foc = 0 %>
|
||||||
|
<% discount = 0 %>
|
||||||
|
<% total = 0 %>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% old_grand_total = 0 %>
|
||||||
|
<% count = 1 %> <% rounding_adj = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% void += sale[:void_amount] %>
|
||||||
|
<% mpu += sale[:mpu_amount] %>
|
||||||
|
<% master += sale[:master_amount] %>
|
||||||
|
<% visa += sale[:visa_amount] %>
|
||||||
|
<% jcb += sale[:jcb_amount] %>
|
||||||
|
<% paypar += sale[:paypar_amount] %>
|
||||||
|
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
||||||
|
<% credit += sale[:credit_amount] %>
|
||||||
|
<% foc += sale[:foc_amount] %>
|
||||||
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% total += sale[:old_grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
|
<% old_grand_total += sale[:old_grand_total].to_f %>
|
||||||
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:right;'><%= count %></td>
|
||||||
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]-sale[:total_change_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:old_grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:old_grand_total]), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="3" style='text-align:center;'>Total</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",old_grand_total), :delimiter => ',') rescue '-'%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% unless @tax.empty? %>
|
||||||
|
<% @tax.each do |tax| %>
|
||||||
|
<% total_tax += tax.tax_amount.to_f %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% net = total - total_tax %>
|
||||||
|
<tr style="font-weight:600;">
|
||||||
|
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,130 +1,125 @@
|
|||||||
<div class="row">
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
<div class="col-md-12">
|
<% if period_type != false %>
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
<div class="row">
|
||||||
<% if period_type != false %>
|
<div class="form-group col-md-2">
|
||||||
<div class="row">
|
<label>Select Period</label>
|
||||||
<div class="form-group col-md-2">
|
<select name="period" id="sel_period" class="form-control">
|
||||||
<label>Select Period</label>
|
<option value="">Select Period</option>
|
||||||
<select name="period" id="sel_period" class="form-control">
|
<option value="0">Today</option>
|
||||||
<option value="">Select Period</option>
|
<option value="1">Yesterday</option>
|
||||||
<option value="0">Today</option>
|
<option value="2">This week</option>
|
||||||
<option value="1">Yesterday</option>
|
<option value="3">Last week</option>
|
||||||
<option value="2">This week</option>
|
<option value="4">Last 7 days</option>
|
||||||
<option value="3">Last week</option>
|
<option value="5">This month</option>
|
||||||
<option value="4">Last 7 days</option>
|
<option value="6">Last month</option>
|
||||||
<option value="5">This month</option>
|
<option value="7">Last 30 days</option>
|
||||||
<option value="6">Last month</option>
|
<option value="8">This year</option>
|
||||||
<option value="7">Last 30 days</option>
|
<option value="9">Last year</option>
|
||||||
<option value="8">This year</option>
|
</select>
|
||||||
<option value="9">Last year</option>
|
</div>
|
||||||
</select>
|
<% if defined? payments %>
|
||||||
</div>
|
<div class="form-group col-md-2">
|
||||||
<% if defined? payments %>
|
<label>Select Payments</label>
|
||||||
<div class="form-group col-md-2">
|
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
||||||
<label>Select Payments</label>
|
</div>
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
<% end %>
|
||||||
</div>
|
<div class="form-group col-md-2">
|
||||||
<% end %>
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
<div class="form-group col-md-2">
|
<label class="">From</label>
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
<label class="">From</label>
|
</div>
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
<div class="form-group col-md-2">
|
||||||
</div>
|
<label class="">To</label>
|
||||||
<div class="form-group col-md-2">
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
<label class="">To</label>
|
</div>
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
<div class="form-group col-md-2">
|
||||||
</div>
|
<label class="">All Shift</label>
|
||||||
<div class="form-group col-md-2">
|
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||||
<label class="">All Shift</label>
|
</select>
|
||||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
</div>
|
||||||
</select>
|
<div class="form-group col-md-1 margin-top-20">
|
||||||
</div>
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
<div class="form-group col-md-1 margin-top-20">
|
</div>
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
$('#custom_excel').click(function(){
|
||||||
var url = $('#custom_excel').attr('data-url');
|
var url = $('#custom_excel').attr('data-url');
|
||||||
$('#frm_report').attr('action',url)
|
$('#frm_report').attr('action',url)
|
||||||
$('#frm_report').submit();
|
$('#frm_report').submit();
|
||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'order'){
|
if(item == 'order'){
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(item == 'sale'){
|
else if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
$("#item").val('sale');
|
$("#item").val('sale');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<% if params[:shift_name].to_i > 0%>
|
<% if params[:shift_name].to_i > 0%>
|
||||||
shift_id = '<%= params[:shift_name] %>'
|
shift_id = '<%= params[:shift_name] %>'
|
||||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||||
shift.append(str);
|
shift.append(str);
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||||
// shift = $(".shift-id").text()
|
// shift = $(".shift-id").text()
|
||||||
// if (shift.length>0) {
|
// if (shift.length>0) {
|
||||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
$("#rd_period_type_1").attr("checked","checked");
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#rd_period_type_0").attr("checked","checked");
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
<% end %>
|
<% end %>
|
||||||
$(".btn-group button").removeClass("active");
|
$(".btn-group button").removeClass("active");
|
||||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
$('#item').change(function(){
|
$('#item').change(function(){
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'sale'){
|
if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').show();
|
$('#payment_type').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,121 +1,125 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<div class="col-md-12">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<div class="page-header">
|
||||||
<li>Receipt List Report</li>
|
<ul class="breadcrumb">
|
||||||
</ul>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
</div>
|
<li>Receipt List Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
|
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card row">
|
<div class="card">
|
||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
|
||||||
</tr>
|
|
||||||
<% if @shift_from %>
|
|
||||||
<tr>
|
|
||||||
<% if @shift_data.employee %>
|
|
||||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
|
||||||
<% end %>
|
|
||||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Recipt No</th>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
<th>Cashier Name</th>
|
</tr>
|
||||||
<th>Total Amount</th>
|
<% if @shift_from %>
|
||||||
<th>Discount Amount </th>
|
<tr>
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% if @shift_data.employee %>
|
||||||
<th><%= tax.tax_name %></th>
|
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- <th>Other Amount</th> -->
|
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||||
<th>Grand Total</th>
|
</tr>
|
||||||
<th>Rounding Adj.</th>
|
<% end %>
|
||||||
<th>Grand Total +<br/>
|
|
||||||
Rounding Adj.
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% grand_total = 0 %>
|
|
||||||
<% old_grand_total = 0 %>
|
|
||||||
<% total_tax = 0 %>
|
|
||||||
<% guest_count = 0 %>
|
|
||||||
<% total_sum = 0 %>
|
|
||||||
<% discount_amt = 0 %>
|
|
||||||
<% other_amt = 0 %>
|
|
||||||
<% total_nett = 0 %>
|
|
||||||
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
|
||||||
<%if @sale_data %>
|
|
||||||
<% @sale_data.each do |result| %>
|
|
||||||
|
|
||||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
<tr>
|
||||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
<th>Recipt No</th>
|
||||||
<% total_tax += result.total_tax.to_f %>
|
<th>Cashier Name</th>
|
||||||
<% total_sum += result.total_amount.to_f %>
|
<th>Total Amount</th>
|
||||||
<% discount_amt += result.total_discount.to_f %>
|
<th>Discount Amount </th>
|
||||||
<% rounding_adj += result.rounding_adjustment.to_f %>
|
<% @sale_taxes.each do |tax| %>
|
||||||
|
<th><%= tax.tax_name %></th>
|
||||||
<tr>
|
<% end %>
|
||||||
|
<!-- <th>Other Amount</th> -->
|
||||||
<td><%= result.receipt_no rescue '-' %> </td>
|
<th>Grand Total</th>
|
||||||
<td><%= result.cashier_name rescue '-' %></td>
|
<th>Rounding Adj.</th>
|
||||||
<td><%= result.total_amount rescue '-' %></td>
|
<th>Grand Total +<br/>
|
||||||
<td><%= result.total_discount rescue '-' %></td>
|
Rounding Adj.
|
||||||
<% result.sale_taxes.each do |tax| %>
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% grand_total = 0 %>
|
||||||
|
<% old_grand_total = 0 %>
|
||||||
|
<% total_tax = 0 %>
|
||||||
|
<% guest_count = 0 %>
|
||||||
|
<% total_sum = 0 %>
|
||||||
|
<% discount_amt = 0 %>
|
||||||
|
<% other_amt = 0 %>
|
||||||
|
<% total_nett = 0 %>
|
||||||
|
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
|
||||||
|
<%if @sale_data %>
|
||||||
|
<% @sale_data.each do |result| %>
|
||||||
|
|
||||||
|
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||||
|
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||||
|
<% total_tax += result.total_tax.to_f %>
|
||||||
|
<% total_sum += result.total_amount.to_f %>
|
||||||
|
<% discount_amt += result.total_discount.to_f %>
|
||||||
|
<% rounding_adj += result.rounding_adjustment.to_f %>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td><%= result.receipt_no rescue '-' %> </td>
|
||||||
|
<td><%= result.cashier_name rescue '-' %></td>
|
||||||
|
<td><%= result.total_amount rescue '-' %></td>
|
||||||
|
<td><%= result.total_discount rescue '-' %></td>
|
||||||
|
<% result.sale_taxes.each do |tax| %>
|
||||||
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
<td><%= tax.tax_payable_amount rescue '-' %></td>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td><%= result.old_grand_total %></td>
|
|
||||||
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
|
||||||
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
<td><%= result.old_grand_total %></td>
|
||||||
<tr style="border-top:4px double #666;">
|
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||||
<td colspan="2"> </td>
|
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
|
||||||
<td><b><%= total_sum rescue '-'%></b></td>
|
</tr>
|
||||||
<td><b><%= discount_amt rescue '-'%></b></td>
|
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% end %>
|
||||||
|
<tr style="border-top:4px double #666;">
|
||||||
|
<td colspan="2"> </td>
|
||||||
|
<td><b><%= total_sum rescue '-'%></b></td>
|
||||||
|
<td><b><%= discount_amt rescue '-'%></b></td>
|
||||||
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td><b><%= tax.st_amount.round(2) %></b></td>
|
<td><b><%= tax.st_amount.round(2) %></b></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
<td><b><%= old_grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<td>Total Amount</td>
|
<td>Total Amount</td>
|
||||||
<td>Discount Amount</td>
|
<td>Discount Amount</td>
|
||||||
<% @sale_taxes.each do |tax| %>
|
<% @sale_taxes.each do |tax| %>
|
||||||
<td><%= tax.tax_name %></td>
|
<td><%= tax.tax_name %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td>Grand Total</td>
|
<td>Grand Total</td>
|
||||||
<td>Rounding Adj.</td>
|
<td>Rounding Adj.</td>
|
||||||
<td>Grand Total +<br/>
|
<td>Grand Total +<br/>
|
||||||
Rounding Adj.
|
Rounding Adj.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<%end%>
|
<%end%>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
<% if period_type != false %>
|
<% if period_type != false %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -52,8 +51,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|||||||
@@ -1,175 +1,179 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="page-header">
|
||||||
|
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
<li>Sale Item Report</li>
|
<li>Sale Item Report</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
|
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
<!-- /div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<div class="margin-top-20">
|
||||||
|
<div class="card">
|
||||||
|
<div class="table-responsive">
|
||||||
|
|
||||||
|
|
||||||
|
<table class="table table-striped" id="items_table" border="0">
|
||||||
|
<thead>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
||||||
|
</tr>
|
||||||
|
<% if @shift_from %>
|
||||||
|
<tr>
|
||||||
|
<% if @shift_data.employee %>
|
||||||
|
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||||
|
<% end %>
|
||||||
|
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<th>Menu Category</th>
|
||||||
|
<th>Code</th>
|
||||||
|
<th>Product</th>
|
||||||
|
<th>Total Item</th>
|
||||||
|
<th>Unit Price</th>
|
||||||
|
<th>Revenue</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% unless @sale_data.blank? %>
|
||||||
|
<% acc_arr = Array.new %>
|
||||||
|
<% cate_arr = Array.new %>
|
||||||
|
|
||||||
|
<% sub_total = 0.0 %>
|
||||||
|
<% count = 0%>
|
||||||
|
<% total_price = 0.0 %>
|
||||||
|
<% cate_count = 0 %>
|
||||||
|
<% acc_count = 0%>
|
||||||
|
<% grand_total = 0%>
|
||||||
|
<% total_qty = 0%>
|
||||||
|
<% total_amount = 0 %>
|
||||||
|
<% discount = 0%>
|
||||||
|
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
|
<% total_qty += sale.total_item %>
|
||||||
|
|
||||||
|
<% if !acc_arr.include?(sale.account_id) %>
|
||||||
|
<tr>
|
||||||
|
<td><b><%= sale.account_name %></b></td>
|
||||||
|
<td colspan="4"> </td>
|
||||||
|
<td>Total Price By <%= sale.account_name %></td>
|
||||||
|
<td>
|
||||||
|
<% @totalByAccount.each do |account, total| %>
|
||||||
|
<% if sale.account_id == account %>
|
||||||
|
<b><%= total %></b>
|
||||||
|
<% grand_total += total %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% acc_arr.push(sale.account_id) %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<% if !cate_arr.include?(sale.menu_category_id) %>
|
||||||
|
<td><%= sale.menu_category_name %></td>
|
||||||
|
<% cate_arr.push(sale.menu_category_id) %>
|
||||||
|
<% else %>
|
||||||
|
<td> </td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= sale.item_code rescue '-' %></td>
|
||||||
|
<td><%= sale.product_name rescue '-' %></td>
|
||||||
|
<td><%= sale.total_item rescue '-' %></td>
|
||||||
|
<td><%= sale.unit_price rescue '-' %></td>
|
||||||
|
<td><%= sale.grand_total rescue '-' %></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- sub total -->
|
||||||
|
<% @menu_cate_count.each do |key,value| %>
|
||||||
|
<% if sale.menu_category_id == key %>
|
||||||
|
|
||||||
|
<% count = count + 1 %>
|
||||||
|
<% sub_total += sale.grand_total %>
|
||||||
|
<% if count == value %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Sub Total</td>
|
||||||
|
<td ><span class="underline"><%= sub_total %></span></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<% sub_total = 0.0%>
|
||||||
|
<% count = 0%>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- end sub total -->
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr style="border-top:2px solid grey;">
|
||||||
|
<td colspan="3"> </td>
|
||||||
|
<td>Total Item</td>
|
||||||
|
<td><span><%= total_qty%></span></td>
|
||||||
|
<td>Total Amount</td>
|
||||||
|
<td><span><%= grand_total%></span></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Cash Received</td>
|
||||||
|
<td><span><%= @cash_data - @change_amount %></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Card Sales</td>
|
||||||
|
<td><span><%= @card_data %></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Credit Sales</td>
|
||||||
|
<td><span><%= @credit_data %></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>FOC Sales</td>
|
||||||
|
<td><span><%= @foc_data %></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Discount Amount</td>
|
||||||
|
<td><span><%= @discount_data %></span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5"> </td>
|
||||||
|
<td>Grand Total</td>
|
||||||
|
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
||||||
|
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
|
|
||||||
|
|
||||||
<table class="table table-striped" id="items_table" border="0">
|
|
||||||
<thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
|
|
||||||
</tr>
|
|
||||||
<% if @shift_from %>
|
|
||||||
<tr>
|
|
||||||
<% if @shift_data.employee %>
|
|
||||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
|
||||||
<% end %>
|
|
||||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
<th>Menu Category</th>
|
|
||||||
<th>Code</th>
|
|
||||||
<th>Product</th>
|
|
||||||
<th>Total Item</th>
|
|
||||||
<th>Unit Price</th>
|
|
||||||
<th>Revenue</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% unless @sale_data.blank? %>
|
|
||||||
<% acc_arr = Array.new %>
|
|
||||||
<% cate_arr = Array.new %>
|
|
||||||
|
|
||||||
<% sub_total = 0.0 %>
|
|
||||||
<% count = 0%>
|
|
||||||
<% total_price = 0.0 %>
|
|
||||||
<% cate_count = 0 %>
|
|
||||||
<% acc_count = 0%>
|
|
||||||
<% grand_total = 0%>
|
|
||||||
<% total_qty = 0%>
|
|
||||||
<% total_amount = 0 %>
|
|
||||||
<% discount = 0%>
|
|
||||||
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% total_qty += sale.total_item %>
|
|
||||||
|
|
||||||
<% if !acc_arr.include?(sale.account_id) %>
|
|
||||||
<tr>
|
|
||||||
<td><b><%= sale.account_name %></b></td>
|
|
||||||
<td colspan="4"> </td>
|
|
||||||
<td>Total Price By <%= sale.account_name %></td>
|
|
||||||
<td>
|
|
||||||
<% @totalByAccount.each do |account, total| %>
|
|
||||||
<% if sale.account_id == account %>
|
|
||||||
<b><%= total %></b>
|
|
||||||
<% grand_total += total %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% acc_arr.push(sale.account_id) %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
<% if !cate_arr.include?(sale.menu_category_id) %>
|
|
||||||
<td><%= sale.menu_category_name %></td>
|
|
||||||
<% cate_arr.push(sale.menu_category_id) %>
|
|
||||||
<% else %>
|
|
||||||
<td> </td>
|
|
||||||
<% end %>
|
|
||||||
<td><%= sale.item_code rescue '-' %></td>
|
|
||||||
<td><%= sale.product_name rescue '-' %></td>
|
|
||||||
<td><%= sale.total_item rescue '-' %></td>
|
|
||||||
<td><%= sale.unit_price rescue '-' %></td>
|
|
||||||
<td><%= sale.grand_total rescue '-' %></td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!-- sub total -->
|
|
||||||
<% @menu_cate_count.each do |key,value| %>
|
|
||||||
<% if sale.menu_category_id == key %>
|
|
||||||
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% sub_total += sale.grand_total %>
|
|
||||||
<% if count == value %>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Sub Total</td>
|
|
||||||
<td ><span class="underline"><%= sub_total %></span></td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<% sub_total = 0.0%>
|
|
||||||
<% count = 0%>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- end sub total -->
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="border-top:2px solid grey;">
|
|
||||||
<td colspan="3"> </td>
|
|
||||||
<td>Total Item</td>
|
|
||||||
<td><span><%= total_qty%></span></td>
|
|
||||||
<td>Total Amount</td>
|
|
||||||
<td><span><%= grand_total%></span></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Cash Received</td>
|
|
||||||
<td><span><%= @cash_data - @change_amount %></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Card Sales</td>
|
|
||||||
<td><span><%= @card_data %></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Credit Sales</td>
|
|
||||||
<td><span><%= @credit_data %></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>FOC Sales</td>
|
|
||||||
<td><span><%= @foc_data %></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Discount Amount</td>
|
|
||||||
<td><span><%= @discount_data %></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5"> </td>
|
|
||||||
<td>Grand Total</td>
|
|
||||||
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
|
|
||||||
<td><span class="double_underline"><%= @grand_total - @change_amount%></span></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|
||||||
@@ -273,5 +277,5 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -1,87 +1,85 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
<% if period_type != false %>
|
||||||
<% if period_type != false %>
|
<div class="row">
|
||||||
<div class="row">
|
<div class="form-group col-md-2">
|
||||||
<div class="form-group col-md-2">
|
<label>Select Period</label>
|
||||||
<label>Select Period</label>
|
<select name="period" id="sel_period" class="form-control">
|
||||||
<select name="period" id="sel_period" class="form-control">
|
<option value="0">Today</option>
|
||||||
<option value="0">Today</option>
|
<option value="1">Yesterday</option>
|
||||||
<option value="1">Yesterday</option>
|
<option value="2">This week</option>
|
||||||
<option value="2">This week</option>
|
<option value="3">Last week</option>
|
||||||
<option value="3">Last week</option>
|
<option value="4">Last 7 days</option>
|
||||||
<option value="4">Last 7 days</option>
|
<option value="5">This month</option>
|
||||||
<option value="5">This month</option>
|
<option value="6">Last month</option>
|
||||||
<option value="6">Last month</option>
|
<option value="7">Last 30 days</option>
|
||||||
<option value="7">Last 30 days</option>
|
<option value="8">This year</option>
|
||||||
<option value="8">This year</option>
|
<option value="9">Last year</option>
|
||||||
<option value="9">Last year</option>
|
</select>
|
||||||
</select>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<div class="form-group col-md-3">
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
<label class="">From</label>
|
||||||
<label class="">From</label>
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-3">
|
||||||
<div class="form-group col-md-3">
|
<label class="">To</label>
|
||||||
<label class="">To</label>
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-2">
|
||||||
<div class="form-group col-md-2">
|
<label class="">All Shift</label>
|
||||||
<label class="">All Shift</label>
|
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
</select>
|
||||||
</select>
|
</div>
|
||||||
</div>
|
<div class="form-group col-md-2 margin-top-20">
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
<% end %>
|
|
||||||
|
<% end %>
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
$('#custom_excel').click(function(){
|
||||||
var url = $('#custom_excel').attr('data-url');
|
var url = $('#custom_excel').attr('data-url');
|
||||||
$('#frm_report').attr('action',url)
|
$('#frm_report').attr('action',url)
|
||||||
$('#frm_report').submit();
|
$('#frm_report').submit();
|
||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'order'){
|
if(item == 'order'){
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(item == 'sale'){
|
else if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
$("#item").val('sale');
|
$("#item").val('sale');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Reset the form to pervious values
|
//Reset the form to pervious values
|
||||||
<% if params[:shift_name].to_i > 0%>
|
<% if params[:shift_name].to_i > 0%>
|
||||||
shift_id = '<%= params[:shift_name] %>'
|
shift_id = '<%= params[:shift_name] %>'
|
||||||
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||||
shift.append(str);
|
shift.append(str);
|
||||||
<% end %>
|
<% end %>
|
||||||
$("#from").val("<%=params[:from]%>");
|
$("#from").val("<%=params[:from]%>");
|
||||||
$("#to").val("<%=params[:to]%>");
|
$("#to").val("<%=params[:to]%>");
|
||||||
@@ -89,9 +87,9 @@ $("#sel_period").val(<%=params[:period]%>);
|
|||||||
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
$("#rd_period_type_1").attr("checked","checked");
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#rd_period_type_0").attr("checked","checked");
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
<% end %>
|
<% end %>
|
||||||
$(".btn-group button").removeClass("active");
|
$(".btn-group button").removeClass("active");
|
||||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
|
|||||||
@@ -1,119 +1,121 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<div class="col-md-12">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<div class="page-header">
|
||||||
<li>Shift Sale Report</li>
|
<ul class="breadcrumb">
|
||||||
</ul>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
</div>
|
<li>Shift Sale Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_shiftsale_index_path} %>
|
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_shiftsale_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%=reports_shiftsale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_shiftsale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<!-- <div class="span11">
|
<!-- <div class="span11">
|
||||||
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="card row">
|
<div class="card">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
|
||||||
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift_data.employee %>
|
<% if @shift_data.employee %>
|
||||||
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Cashier Station</th>
|
<th>Cashier Station</th>
|
||||||
<th>Cashier Name</th>
|
<th>Cashier Name</th>
|
||||||
<th>Shift Name</th>
|
<th>Shift Name</th>
|
||||||
<!-- <th>Void Amount</th> -->
|
<!-- <th>Void Amount</th> -->
|
||||||
<th>Cash Payment</th>
|
<th>Cash Payment</th>
|
||||||
<!-- <th>Credit Charges</th> -->
|
<!-- <th>Credit Charges</th> -->
|
||||||
<th>Credit Payment</th>
|
<th>Credit Payment</th>
|
||||||
<!-- <th>FOC Payment</th> -->
|
<!-- <th>FOC Payment</th> -->
|
||||||
<th>Other Payment</th>
|
<th>Other Payment</th>
|
||||||
<!-- <th>Grand Total
|
<!-- <th>Grand Total
|
||||||
<br/>Rounding Adj</th> -->
|
<br/>Rounding Adj</th> -->
|
||||||
<!-- <th>Rounding Adj</th> -->
|
<!-- <th>Rounding Adj</th> -->
|
||||||
<th>Grand Total</th>
|
<th>Grand Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% void = 0%>
|
<% void = 0%>
|
||||||
<% cash = 0%>
|
<% cash = 0%>
|
||||||
<% credit = 0%>
|
<% credit = 0%>
|
||||||
<% accept_credit = 0%>
|
<% accept_credit = 0%>
|
||||||
<% foc = 0%>
|
<% foc = 0%>
|
||||||
<% card = 0%>
|
<% card = 0%>
|
||||||
<% total = 0%>
|
<% total = 0%>
|
||||||
<% rounding_adj = 0%>
|
<% rounding_adj = 0%>
|
||||||
<% g_total = 0 %>
|
<% g_total = 0 %>
|
||||||
|
|
||||||
<% @sale_data.each do |result|%>
|
<% @sale_data.each do |result|%>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= result.cashier_terminal.name rescue '-'%>
|
<%= result.cashier_terminal.name rescue '-'%>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= result.employee.name rescue '-'%>
|
<%= result.employee.name rescue '-'%>
|
||||||
</td>
|
</td>
|
||||||
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
|
||||||
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
|
||||||
</td>
|
</td>
|
||||||
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
|
||||||
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
|
||||||
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
|
||||||
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
|
||||||
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
|
||||||
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
|
||||||
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
|
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
|
||||||
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
|
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
|
||||||
|
|
||||||
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
|
||||||
<% grand_total = result.grand_total.to_f %>
|
<% grand_total = result.grand_total.to_f %>
|
||||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||||
</tr>
|
</tr>
|
||||||
<% cash += result.cash_sales.to_f %>
|
<% cash += result.cash_sales.to_f %>
|
||||||
<% credit += result.credit_sales.to_f %>
|
<% credit += result.credit_sales.to_f %>
|
||||||
<% card += result.other_sales.to_f %>
|
<% card += result.other_sales.to_f %>
|
||||||
|
|
||||||
<% total += result.grand_total.to_f %>
|
|
||||||
<% g_total += grand_total.to_f %>
|
|
||||||
|
|
||||||
<% end %>
|
<% total += result.grand_total.to_f %>
|
||||||
|
<% g_total += grand_total.to_f %>
|
||||||
|
|
||||||
<tr style="border-top: 3px solid grey;">
|
<% end %>
|
||||||
<td colspan="3"></td>
|
|
||||||
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
<tr style="border-top: 3px solid grey;">
|
||||||
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
<td colspan="3"></td>
|
||||||
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
|
||||||
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
|
||||||
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
|
||||||
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
|
||||||
</tr>
|
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
|
||||||
</tbody>
|
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
<%= form_tag report_path, :method => :get, :id => "frm_report", :class => "form" do %>
|
||||||
<% if period_type != false %>
|
<% if period_type != false %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -38,8 +37,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|||||||
@@ -1,87 +1,89 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<div class="col-md-12">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<div class="page-header">
|
||||||
<li>Stock Check Report</li>
|
<ul class="breadcrumb">
|
||||||
</ul>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
</div>
|
<li>Stock Check Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial => 'stock_check_report_filter',
|
<%= render :partial => 'stock_check_report_filter',
|
||||||
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
|
:locals => {:period_type => true, :shift_name => true, :report_path => reports_stock_check_index_path} %>
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="text-right">
|
||||||
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-default">Export to
|
<a href="javascript:export_to('<%= reports_stock_check_index_path %>.xls')" class="btn btn-default">Export to
|
||||||
Excel</a>
|
Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card row">
|
<div class="card">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="8"><i> From Date </i>: <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <i>To Date</i> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
|
<th colspan="8"><i> From Date </i>: <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <i>To Date</i> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Stock Check Reason</th>
|
<th>Stock Check Reason</th>
|
||||||
<th>Checked By</th>
|
<th>Checked By</th>
|
||||||
<th>Item Name</th>
|
<th>Item Name</th>
|
||||||
<th>Stock Count</th>
|
<th>Stock Count</th>
|
||||||
<th>Stock Balance</th>
|
<th>Stock Balance</th>
|
||||||
<th>Different</th>
|
<th>Different</th>
|
||||||
<th>Remark</th>
|
<th>Remark</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% total_stock_count = 0 %>
|
<% total_stock_count = 0 %>
|
||||||
<% total_stock_balance = 0 %>
|
<% total_stock_balance = 0 %>
|
||||||
<% total_different = 0 %>
|
<% total_different = 0 %>
|
||||||
|
|
||||||
<% @transaction.each do |result| %>
|
<% @transaction.each do |result| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= result.stock_check.reason rescue '-' %></td>
|
<td><%= result.stock_check.reason rescue '-' %></td>
|
||||||
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
|
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
|
||||||
<td>
|
<td>
|
||||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
||||||
<% if menu_item.nil? %>
|
<% if menu_item.nil? %>
|
||||||
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
|
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= menu_item.menu_item.name rescue "-" %>
|
<%= menu_item.menu_item.name rescue "-" %>
|
||||||
- <%= menu_item.item_instance_name rescue "-" %>
|
- <%= menu_item.item_instance_name rescue "-" %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td><%= result.stock_count rescue '-' %></td>
|
||||||
|
<td><%= result.stock_balance rescue '-' %></td>
|
||||||
|
<td><%= result.different rescue '-' %></td>
|
||||||
|
<td><%= result.remark rescue '-' %></td>
|
||||||
|
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
|
||||||
|
</tr>
|
||||||
|
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
|
||||||
|
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
|
||||||
|
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
|
||||||
<td><%= result.stock_count rescue '-' %></td>
|
|
||||||
<td><%= result.stock_balance rescue '-' %></td>
|
|
||||||
<td><%= result.different rescue '-' %></td>
|
|
||||||
<td><%= result.remark rescue '-' %></td>
|
|
||||||
<td><%= result.created_at.strftime('%e %b %Y %I:%M %p') rescue '-' %></td>
|
|
||||||
</tr>
|
|
||||||
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
|
|
||||||
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
|
|
||||||
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="border-top: 3px solid grey;">
|
<tr style="border-top: 3px solid grey;">
|
||||||
<td colspan="3"></td>
|
<td colspan="3"></td>
|
||||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||||
<td><b><%= total_stock_balance rescue '-' %></b></td>
|
<td><b><%= total_stock_balance rescue '-' %></b></td>
|
||||||
<td><b><%= total_different rescue '-' %></b></td>
|
<td><b><%= total_different rescue '-' %></b></td>
|
||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -1,125 +1,120 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="">Select Period</option>
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">All Shift</label>
|
|
||||||
<select class="form-control select" name="shift_name" id="shift_name" >
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-1 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
||||||
|
<% if period_type != false %>
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label>Select Period</label>
|
||||||
|
<select name="period" id="sel_period" class="form-control">
|
||||||
|
<option value="">Select Period</option>
|
||||||
|
<option value="0">Today</option>
|
||||||
|
<option value="1">Yesterday</option>
|
||||||
|
<option value="2">This week</option>
|
||||||
|
<option value="3">Last week</option>
|
||||||
|
<option value="4">Last 7 days</option>
|
||||||
|
<option value="5">This month</option>
|
||||||
|
<option value="6">Last month</option>
|
||||||
|
<option value="7">Last 30 days</option>
|
||||||
|
<option value="8">This year</option>
|
||||||
|
<option value="9">Last year</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
|
<label class="">From</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-2">
|
||||||
|
<label class="">To</label>
|
||||||
|
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label class="">All Shift</label>
|
||||||
|
<select class="form-control select" name="shift_name" id="shift_name" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-1 margin-top-20">
|
||||||
|
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
$('#custom_excel').click(function(){
|
||||||
var url = $('#custom_excel').attr('data-url');
|
var url = $('#custom_excel').attr('data-url');
|
||||||
$('#frm_report').attr('action',url)
|
$('#frm_report').attr('action',url)
|
||||||
$('#frm_report').submit();
|
$('#frm_report').submit();
|
||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
var item = $('#item').val();
|
|
||||||
var payment_type = $('#payment_type');
|
|
||||||
|
|
||||||
if(item == 'order'){
|
|
||||||
$('#cashier').hide();
|
|
||||||
$('#waiter').show();
|
|
||||||
if(payment_type){
|
|
||||||
$('#payment_type').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(item == 'sale'){
|
|
||||||
$('#waiter').hide();
|
|
||||||
$('#cashier').show();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('#waiter').hide();
|
|
||||||
$('#cashier').show();
|
|
||||||
$("#item").val('sale');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
<% if params[:shift_name].to_i > 0%>
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'order'){
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
$("#item").val('sale');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
<% if params[:shift_name].to_i > 0%>
|
||||||
shift_id = '<%= params[:shift_name] %>'
|
shift_id = '<%= params[:shift_name] %>'
|
||||||
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
local_date = '<%= @shift_from %> - <%= @shift_to %> '
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
|
||||||
shift.append(str);
|
shift.append(str);
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
$("#from").val("<%=params[:from] rescue '-'%>");
|
$("#from").val("<%=params[:from] rescue '-'%>");
|
||||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||||
// shift = $(".shift-id").text()
|
// shift = $(".shift-id").text()
|
||||||
// if (shift.length>0) {
|
// if (shift.length>0) {
|
||||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
$("#rd_period_type_1").attr("checked","checked");
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#rd_period_type_0").attr("checked","checked");
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
<% end %>
|
<% end %>
|
||||||
$(".btn-group button").removeClass("active");
|
$(".btn-group button").removeClass("active");
|
||||||
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
$("#btn_report_type_<%= report_type %>").addClass("active");
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
$('#item').change(function(){
|
$('#item').change(function(){
|
||||||
var item = $('#item').val();
|
var item = $('#item').val();
|
||||||
var payment_type = $('#payment_type');
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
if(item == 'sale'){
|
if(item == 'sale'){
|
||||||
$('#waiter').hide();
|
$('#waiter').hide();
|
||||||
$('#cashier').show();
|
$('#cashier').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').show();
|
$('#payment_type').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#cashier').hide();
|
$('#cashier').hide();
|
||||||
$('#waiter').show();
|
$('#waiter').show();
|
||||||
if(payment_type){
|
if(payment_type){
|
||||||
$('#payment_type').hide();
|
$('#payment_type').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,99 +1,97 @@
|
|||||||
<div class="page-header">
|
<div class="row">
|
||||||
<ul class="breadcrumb">
|
<div class="col-md-12">
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
<div class="page-header">
|
||||||
<li>Void Sale Report</li>
|
<ul class="breadcrumb">
|
||||||
</ul>
|
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||||
</div>
|
<li>Void Sale Report</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %>
|
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_void_sale_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container">
|
<!-- <div class="container"> -->
|
||||||
<div class="row">
|
<!-- <div class="row"> -->
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<a href="javascript:export_to('<%=reports_void_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_void_sale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
<div class="margin-top-20">
|
||||||
<div class="card row">
|
<div class="card">
|
||||||
<% if @sale_data.count > 0 %>
|
<% if @sale_data.count > 0 %>
|
||||||
<table class="table table-striped" border="0">
|
<table class="table table-striped" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
<% if !params[:from].blank?%>
|
<% if !params[:from].blank?%>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
|
<th colspan="7">From Date : <%= params[:from] rescue '-'%> , To Date : <%= params[:to] rescue '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @shift_from %>
|
<% if @shift_from %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if @shift %>
|
<% if @shift %>
|
||||||
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
|
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th colspan="3">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
<th colspan="3">Shift Name = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Receipt No</th>
|
<th>Receipt No</th>
|
||||||
<th>Sale Date</th>
|
<th>Sale Date</th>
|
||||||
<th>Total Amount</th>
|
<th>Total Amount</th>
|
||||||
<th>Grand Total</th>
|
<th>Grand Total</th>
|
||||||
<th>Rounding Adj.</th>
|
<th>Rounding Adj.</th>
|
||||||
<th>Grand Total + <br/>Rounding Adj.</th>
|
<th>Grand Total + <br/>Rounding Adj.</th>
|
||||||
<!-- <th>Sale Status</th> -->
|
<!-- <th>Sale Status</th> -->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% total_amount = 0.0 %>
|
<% total_amount = 0.0 %>
|
||||||
<% grand_total = 0.0 %>
|
<% grand_total = 0.0 %>
|
||||||
<% rounding_adjustment = 0.0 %>
|
<% rounding_adjustment = 0.0 %>
|
||||||
<% grand_rounding_adjustment = 0.0 %>
|
<% grand_rounding_adjustment = 0.0 %>
|
||||||
<% @sale_data.each do |result| %>
|
<% @sale_data.each do |result| %>
|
||||||
<% result[:items].each do |item| %>
|
<% result[:items].each do |item| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= item.receipt_no rescue '-' %> </td>
|
<td><%= item.receipt_no rescue '-' %> </td>
|
||||||
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
<td><%= item.receipt_date.utc.getlocal.strftime("%e %b %I:%M%p") rescue '-' %></td>
|
||||||
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
<td><%= item.total_amount.to_f rescue '-'%> </td>
|
||||||
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
<td><%= item.grand_total.to_f rescue '-'%> </td>
|
||||||
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
|
||||||
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
|
||||||
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
<!-- <td><%= result.sales_status rescue '-' %> </td> -->
|
||||||
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
<!-- <td><%= item.remarks rescue '-' %> </td> -->
|
||||||
</tr>
|
</tr>
|
||||||
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
|
||||||
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
|
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
|
||||||
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
|
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
|
||||||
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
|
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<tr style="border-top:4px double #666;font-weight:600;">
|
<tr style="border-top:4px double #666;font-weight:600;">
|
||||||
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
|
||||||
<td><%= total_amount rescue '-' %></td>
|
<td><%= total_amount rescue '-' %></td>
|
||||||
<td><%= grand_total rescue '-' %></td>
|
<td><%= grand_total rescue '-' %></td>
|
||||||
<td><%= rounding_adjustment rescue '-'%></td>
|
<td><%= rounding_adjustment rescue '-'%></td>
|
||||||
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
<td colspan="3"><%= grand_rounding_adjustment rescue '-'%></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|
||||||
var check_arr = [];
|
var check_arr = [];
|
||||||
|
|
||||||
$('#sel_period').change(function(){
|
$('#sel_period').change(function(){
|
||||||
|
|
||||||
search_by_period();
|
search_by_period();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function search_by_period(){
|
function search_by_period(){
|
||||||
var period = $('#sel_period').val();
|
var period = $('#sel_period').val();
|
||||||
var period_type = 0;
|
var period_type = 0;
|
||||||
@@ -102,15 +100,15 @@
|
|||||||
|
|
||||||
show_shift_name(period,period_type,from,to,'shift_item');
|
show_shift_name(period,period_type,from,to,'shift_item');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#from').change(function(){
|
$('#from').change(function(){
|
||||||
search_by_date();
|
search_by_date();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#to').change(function(){
|
$('#to').change(function(){
|
||||||
search_by_date();
|
search_by_date();
|
||||||
});
|
});
|
||||||
|
|
||||||
function search_by_date(){
|
function search_by_date(){
|
||||||
var from = $('#from').val();
|
var from = $('#from').val();
|
||||||
var to = $('#to').val();
|
var to = $('#to').val();
|
||||||
@@ -121,7 +119,7 @@
|
|||||||
shift_name = from + ',' + to;
|
shift_name = from + ',' + to;
|
||||||
|
|
||||||
check_arr.push(to);
|
check_arr.push(to);
|
||||||
|
|
||||||
console.log(check_arr.length)
|
console.log(check_arr.length)
|
||||||
if(check_arr.length == 1){
|
if(check_arr.length == 1){
|
||||||
show_shift_name(period,period_type,from,to,'shift_item');
|
show_shift_name(period,period_type,from,to,'shift_item');
|
||||||
@@ -130,25 +128,25 @@
|
|||||||
check_arr = [];
|
check_arr = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_shift_name(period,period_type,from,to,shift_item){
|
function show_shift_name(period,period_type,from,to,shift_item){
|
||||||
var shift = $('#shift_name');
|
var shift = $('#shift_name');
|
||||||
|
|
||||||
shift.empty();
|
shift.empty();
|
||||||
|
|
||||||
var str = '';
|
var str = '';
|
||||||
var param_shift = '';
|
var param_shift = '';
|
||||||
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
var param_shift = '<%= params[:shift_name] rescue '-'%>';
|
||||||
|
|
||||||
url = '<%= reports_get_shift_by_date_path %>';
|
url = '<%= reports_get_shift_by_date_path %>';
|
||||||
|
|
||||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||||
|
|
||||||
str = '<option value="0">--- All Shift ---</option>';
|
str = '<option value="0">--- All Shift ---</option>';
|
||||||
$(data.message).each(function(index){
|
$(data.message).each(function(index){
|
||||||
|
|
||||||
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
|
||||||
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
|
||||||
var shift_id = data.message[index].shift_id ;
|
var shift_id = data.message[index].shift_id ;
|
||||||
@@ -163,7 +161,7 @@
|
|||||||
selected = '';
|
selected = '';
|
||||||
}
|
}
|
||||||
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
|
||||||
|
|
||||||
// console.log(sh_date)
|
// console.log(sh_date)
|
||||||
})
|
})
|
||||||
shift.append(str);
|
shift.append(str);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ module SXRestaurants
|
|||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
config.i18n.default_locale = :'en'
|
||||||
|
|
||||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
config.time_zone = 'Asia/Rangoon'
|
config.time_zone = 'Asia/Rangoon'
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
|
|||||||
Rails.application.config.assets.precompile += %w( addorder.css )
|
Rails.application.config.assets.precompile += %w( addorder.css )
|
||||||
Rails.application.config.assets.precompile += %w( addorder.js )
|
Rails.application.config.assets.precompile += %w( addorder.js )
|
||||||
|
|
||||||
|
# --- Custom SX Themem ----
|
||||||
|
Rails.application.config.assets.precompile += %w( sx-sidebar.css )
|
||||||
|
Rails.application.config.assets.precompile += %w( popper.min.js )
|
||||||
|
|
||||||
# --- Inventory Definition ----
|
# --- Inventory Definition ----
|
||||||
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
|
Rails.application.config.assets.precompile += %w( inventory_definitions.css )
|
||||||
|
|
||||||
|
|||||||
45
config/initializers/mysql2_adapter.rb
Executable file
45
config/initializers/mysql2_adapter.rb
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
module ActiveRecord
|
||||||
|
class Base
|
||||||
|
# Overriding ActiveRecord::Base.mysql2_connection
|
||||||
|
# method to allow passing options from database.yml
|
||||||
|
#
|
||||||
|
# Example of database.yml
|
||||||
|
#
|
||||||
|
# login: &login
|
||||||
|
# socket: /tmp/mysql.sock
|
||||||
|
# adapter: mysql2
|
||||||
|
# host: localhost
|
||||||
|
# encoding: utf8
|
||||||
|
# flags: 131072
|
||||||
|
#
|
||||||
|
# @param [Hash] config hash that you define in your
|
||||||
|
# database.yml
|
||||||
|
# @return [Mysql2Adapter] new MySQL adapter object
|
||||||
|
#
|
||||||
|
def self.mysql2_connection(config)
|
||||||
|
config[:username] = 'root' if config[:username].nil?
|
||||||
|
|
||||||
|
if Mysql2::Client.const_defined? :FOUND_ROWS
|
||||||
|
config[:flags] = config[:flags] ? config[:flags] | Mysql2::Client::FOUND_ROWS : Mysql2::Client::FOUND_ROWS
|
||||||
|
end
|
||||||
|
|
||||||
|
client = Mysql2::Client.new(config.symbolize_keys)
|
||||||
|
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
|
||||||
|
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# This method is for running stored procedures.
|
||||||
|
#
|
||||||
|
# @return [Hash]
|
||||||
|
#
|
||||||
|
def self.select_sp(sql, name = nil)
|
||||||
|
connection = ActiveRecord::Base.connection
|
||||||
|
begin
|
||||||
|
connection.select_all(sql, name)
|
||||||
|
rescue NoMethodError
|
||||||
|
ensure
|
||||||
|
connection.reconnect! unless connection.active?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
6
config/initializers/secrets.rb
Executable file
6
config/initializers/secrets.rb
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
# config = YAML.load_file(Rails.root.join("config/smartsales.yml"))
|
||||||
|
# config.fetch(Rails.env, {}).each do |key, value|
|
||||||
|
# ENV[key.upcase] = value.to_s
|
||||||
|
# end
|
||||||
|
|
||||||
|
SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
||||||
4
config/initializers/sx.rb
Normal file
4
config/initializers/sx.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
config = YAML.load_file(Rails.root.join("config/sx.yml"))
|
||||||
|
config.fetch(Rails.env, {}).each do |key, value|
|
||||||
|
ENV[key.upcase] = value.to_s
|
||||||
|
end
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
en:
|
en:
|
||||||
|
welcome: "Welcome"
|
||||||
views:
|
views:
|
||||||
pagination:
|
pagination:
|
||||||
first: "« First"
|
first: "« First"
|
||||||
|
|||||||
18
config/locales/mm.yml
Normal file
18
config/locales/mm.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
mm:
|
||||||
|
welcome: "လာပါ"
|
||||||
|
views:
|
||||||
|
pagination:
|
||||||
|
first: "« ပထမ"
|
||||||
|
last: "အဆံုး »"
|
||||||
|
previous: "‹ ေနာက္သို့"
|
||||||
|
next: "ေရ့သို့ ›"
|
||||||
|
truncate: "…"
|
||||||
|
helpers:
|
||||||
|
page_entries_info:
|
||||||
|
one_page:
|
||||||
|
display_entries:
|
||||||
|
zero: "No %{entry_name} found"
|
||||||
|
one: "Displaying <b>1</b> %{entry_name}"
|
||||||
|
other: "Displaying <b>all %{count}</b> %{entry_name}"
|
||||||
|
more_pages:
|
||||||
|
display_entries: "Displaying %{entry_name} <b>%{first} - %{last}</b> of <b>%{total}</b> in total"
|
||||||
@@ -2,7 +2,7 @@ require 'sidekiq/web'
|
|||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
scope "(:locale)", locale: /en|mm/ do
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
mount Sidekiq::Web => '/kiq'
|
mount Sidekiq::Web => '/kiq'
|
||||||
|
|
||||||
@@ -375,3 +375,4 @@ Rails.application.routes.draw do
|
|||||||
resources :commissioners
|
resources :commissioners
|
||||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
|
provision_key: IAAXHpbSWAfvlWGYpDoXvZdmuRABNGk
|
||||||
|
|
||||||
test:
|
test:
|
||||||
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
secret_key_base: 5c92143fd4a844fdaf8b22aba0cda22ef1fc68f1b26dd3d40656866893718ae5e58625b4c3a5dc86b04c8be0a505ec0ebc0be3bf52249a3d1e0c1334ee591cf0
|
||||||
@@ -20,4 +21,5 @@ test:
|
|||||||
# instead read values from the environment.
|
# instead read values from the environment.
|
||||||
production:
|
production:
|
||||||
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
secret_key_base: c4bc81065013f9a3506d385bcbd49586c42e586488144b0de90c7da36867de9fa880f46b5c4f86f0ce9b7c783bb5a73bdb0e5605a47716567294390e726d3e22
|
||||||
|
provision_key: IAAXHpbSWAfvlWGYpDoXvZdmuRABNGk
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
development:
|
development:
|
||||||
server_mode: cloud #local
|
server_mode: cloud #local
|
||||||
sx_provision_url: http://192.168.1.75:3002/api
|
sx_provision_url: http://192.168.1.162:3005/api
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@@ -11,3 +11,4 @@ test:
|
|||||||
production:
|
production:
|
||||||
server_mode: cloud
|
server_mode: cloud
|
||||||
sx_provision_url: secure.smartsales.asia/api
|
sx_provision_url: secure.smartsales.asia/api
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
|||||||
create_table :print_settings do |t|
|
create_table :print_settings do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :unique_code, :null => false
|
t.string :unique_code, :null => false
|
||||||
t.string :template
|
t.string :template
|
||||||
|
t.string :font
|
||||||
t.string :printer_name, :null => false
|
t.string :printer_name, :null => false
|
||||||
t.string :api_settings
|
t.string :api_settings
|
||||||
t.decimal :page_width, :null => false, :default => 200
|
t.decimal :page_width, :null => false, :default => 200
|
||||||
|
|||||||
Reference in New Issue
Block a user