Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
@@ -62,9 +62,6 @@ $(document).ready(function() {
|
||||
clearButton: true,
|
||||
date: false
|
||||
});
|
||||
|
||||
// first input focus for all form
|
||||
$("body").has("form").find("input:first").focus();
|
||||
|
||||
// Image Upload
|
||||
$("#simple_menu_item_image_path").fileinput({
|
||||
@@ -107,6 +104,9 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// first input focus for all form
|
||||
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
|
||||
|
||||
// $(document).on("focus", "[data-behaviour~='datepicker']", function(e){
|
||||
// $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
|
||||
// $('.dropdown-toggle').dropdown();
|
||||
|
||||
@@ -114,9 +114,11 @@
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
.left{
|
||||
|
||||
.left-margin-1 {
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
.bottom{
|
||||
margin-bottom:1px;
|
||||
}
|
||||
|
||||
@@ -93,3 +93,9 @@ nav.pagination .page a:hover,
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
/*Logout Icon*/
|
||||
i.logout_icon{
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
@@ -262,6 +262,10 @@ select.form-control {
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
.dtp-date .left{
|
||||
margin-left:0px;
|
||||
}
|
||||
|
||||
.bottom{
|
||||
margin-bottom:1px;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,12 @@ class ApplicationController < ActionController::Base
|
||||
{ locale: I18n.locale }
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) # request.subdomain.downcase
|
||||
def lookup_domain
|
||||
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase #+ "." + request.domain.downcase
|
||||
puts from
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
@@ -54,10 +57,18 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
# Export for Key
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(lookup)
|
||||
flag = ENV["AES_IV"]
|
||||
@license = License.new(url, lookup)
|
||||
|
||||
# Check Exists IV
|
||||
if flag == "<%= ENV['AES_IV'] %>"
|
||||
# Export for Key
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(lookup)
|
||||
else
|
||||
aes_key = ENV["AES_KEY"]
|
||||
aes_iv = ENV["AES_IV"]
|
||||
end
|
||||
|
||||
if (@license.detail_with_local_cache(lookup, aes_key, aes_iv) == true)
|
||||
return @license
|
||||
@@ -110,7 +121,7 @@ class ApplicationController < ActionController::Base
|
||||
if License.check_license_file
|
||||
return true
|
||||
else
|
||||
redirect_to install_path
|
||||
redirect_to activate_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,42 +1,77 @@
|
||||
class InstallController < BaseController
|
||||
skip_before_action :verify_authenticity_token
|
||||
before_action :check_license
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def create
|
||||
def activate
|
||||
flag = "<%= ENV['AES_IV'] %>"
|
||||
key_base = "<%= ENV['secret_key_base'] %>"
|
||||
|
||||
restaurant = params[:restaurant_name]
|
||||
license_key = params[:license_key]
|
||||
admin_user = params[:admin_user]
|
||||
admin_password = params[:admin_password]
|
||||
# admin_user = params[:admin_user]
|
||||
# admin_password = params[:admin_password]
|
||||
db_host = params[:db_host]
|
||||
db_schema = params[:db_schema]
|
||||
db_user = params[:db_user]
|
||||
db_password = params[:db_password]
|
||||
phrase = key_base == "<%= ENV['secret_key_base'] %>"? license_key : "<%= ENV['secret_key_base'] %>"
|
||||
|
||||
# Check Exists IV
|
||||
if flag == "<%= ENV['AES_IV'] %>"
|
||||
# Export for Key
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(phrase)
|
||||
else
|
||||
aes_key = ENV["AES_KEY"]
|
||||
aes_iv = ENV["AES_IV"]
|
||||
end
|
||||
|
||||
@license = License.new(ENV["SX_PROVISION_URL"])
|
||||
response = @license.license_activate(aes_key, aes_iv, license_key, db_host, db_schema, db_user, db_password)
|
||||
if response[:status]
|
||||
redirect_to root_url, notice: response["message"]
|
||||
else
|
||||
redirect_to activate_path, notice: response["message"]
|
||||
end
|
||||
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
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
redirect_to root_url
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
# 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
|
||||
|
||||
##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)
|
||||
# def current_license(url, key)
|
||||
# @license = License.new(url, key)
|
||||
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
# ##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
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -17,7 +17,7 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_item_code(order_item.item_code)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
@@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.item_code, print_status=" (Edited)" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.instance_code, print_status=" (Edited)" )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
if sale_payment.payment_method == "creditnote"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
|
||||
@@ -161,9 +161,9 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale = Sale.find(sale_id)
|
||||
|
||||
# Check for Card Payment
|
||||
is_card_payment = SaleItem.get_sale_payments_by_card(sale.sale_payments)
|
||||
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
||||
|
||||
if is_card_payment != true
|
||||
if is_card != "true"
|
||||
account_types = Account.where("discount=?",true)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
@@ -100,10 +100,5 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def void_before_pay
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -67,7 +67,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||
@@ -105,9 +105,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
||||
|
||||
@@ -29,8 +29,12 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
if !@promotion.promo_end_hour.nil?
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
respond_to do |format|
|
||||
if @promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
@@ -95,16 +99,23 @@ class Settings::PromotionsController < ApplicationController
|
||||
|
||||
def find_parent_item
|
||||
res = []
|
||||
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item.nil?
|
||||
arr_inst = []
|
||||
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item_inst.nil?
|
||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
||||
res.push(product.name)
|
||||
res.push(product.item_code)
|
||||
else
|
||||
# menu_item = item.menu_item.pluck(:name,:item_code)
|
||||
res.push(item.item_instance_name)
|
||||
res.push(item.menu_item.item_code)
|
||||
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
||||
# res.push(item_inst.item_instance_name)
|
||||
# res.push(item_inst.menu_item.item_code)
|
||||
item_inst.menu_item.menu_item_instances.each do |inst|
|
||||
arr_inst.push({inst.item_instance_code => inst.item_instance_name})
|
||||
end
|
||||
res.push({item_inst.menu_item.item_code => arr_inst})
|
||||
end
|
||||
puts "res"
|
||||
p res
|
||||
render json: res
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class Transactions::BookingsController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
filter = params[:receipt_no]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil?
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search_credit_sales(customer,filter,from,to)
|
||||
if sale.count > 0
|
||||
|
||||
@@ -3,16 +3,13 @@ class Transactions::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
count = params[:count]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
|
||||
else
|
||||
orders = Order.search(filter,from,to,count)
|
||||
|
||||
orders = Order.search(filter,from,to)
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
|
||||
@@ -3,9 +3,8 @@ class OrderQueueProcessorJob < ApplicationJob
|
||||
|
||||
def perform(order_id, table_id)
|
||||
# Do something later
|
||||
#Order ID
|
||||
|
||||
order = Order.find(order_id)
|
||||
#Order ID
|
||||
order = Order.find(order_id)
|
||||
|
||||
#Execute orders and send to order stations
|
||||
if order
|
||||
|
||||
@@ -21,14 +21,6 @@ class License
|
||||
|
||||
# @secret = ENV["aes_key"]
|
||||
# @params = { query: { device: "SX", 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, iv)
|
||||
@@ -41,9 +33,11 @@ class License
|
||||
cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
Redis.current do |conn|
|
||||
cache_license = conn.get(cache_key)
|
||||
end
|
||||
redis = Redis.new
|
||||
cache_license = redis.get(cache_key)
|
||||
# Redis.current do |conn|
|
||||
# cache_license = conn.get(cache_key)
|
||||
# end
|
||||
|
||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
if cache_license.nil?
|
||||
@@ -54,22 +48,27 @@ class License
|
||||
@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
|
||||
|
||||
redis = Redis.new
|
||||
redis.set(cache_key, Marshal.dump(@license))
|
||||
# redis.sadd("License:cache:keys", cache_key)
|
||||
# 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)
|
||||
assign()
|
||||
Rails.logger.info 'API License'
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,65 +79,35 @@ class License
|
||||
if has_license
|
||||
# puts "VERIFIED"
|
||||
end
|
||||
end
|
||||
|
||||
# if cache_license.nil?
|
||||
# ##change the d/e key
|
||||
# @params = { query: { lookup_type: self.server_mode, lookup: lookup, encrypted_key: key, iv_key: iv} }
|
||||
# License Activation
|
||||
def license_activate (key, iv, license_key, db_host, db_schema, db_user, db_password)
|
||||
@params = { query: { lookup_type: self.server_mode, encrypted_key: key, iv_key: iv, license_key: license_key } }
|
||||
response = self.class.get("/activate", @params)
|
||||
@activate = response.parsed_response
|
||||
|
||||
# response = self.class.get("/request_license", @params)
|
||||
# @license = response.parsed_response
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
|
||||
# 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
|
||||
if (@activate["status"])
|
||||
response = create_license_file(@activate)
|
||||
if(response["status"])
|
||||
sym_path = "/home/yan/symmetric/"
|
||||
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
|
||||
if(response["status"])
|
||||
response = run_symmetric(sym_path)
|
||||
end
|
||||
end
|
||||
else
|
||||
response = { "status": false, "message": "Activation Failed! Please contact code2lab call center!"}
|
||||
end
|
||||
return response
|
||||
end
|
||||
|
||||
def verify_license
|
||||
api_token = read_license("api_token")
|
||||
@options = { query: {lookup_type: "application", token: api_token} }
|
||||
response = self.class.get("/verify", @options)
|
||||
@params = { query: {lookup_type: "application", token: api_token} }
|
||||
response = self.class.get("/verify", @params)
|
||||
@varified = response.parsed_response
|
||||
|
||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||
@@ -152,37 +121,7 @@ class License
|
||||
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: {lookup_type: "application", encrypted_key: @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: "SX", 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.
|
||||
|
||||
|
||||
# Check License expired date from PROVISION SERVER
|
||||
def check_expired(renewal_date)
|
||||
if (renewal_date < Date.today)
|
||||
return true
|
||||
@@ -191,6 +130,7 @@ class License
|
||||
end
|
||||
end
|
||||
|
||||
# Check License File exists
|
||||
def self.check_license_file
|
||||
return File.exist?("config/license.yml")
|
||||
end
|
||||
@@ -202,13 +142,156 @@ class License
|
||||
File.open("config/license.yml").each do |line|
|
||||
if line.include? (key)
|
||||
decrypted_line_array = line.split(":")
|
||||
decrypted_line = AESCrypt.decrypt(decrypted_line_array[1])
|
||||
decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(ENV['AES_KEY']), decode_str(ENV['AES_IV']), ENV['CIPHER_TYPE'])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def decode_str(str)
|
||||
return Base64.decode64(str)
|
||||
end
|
||||
|
||||
# License File Creation
|
||||
def create_license_file(response_data)
|
||||
if File.exist?("config/license.yml")
|
||||
delete_license_file
|
||||
end
|
||||
|
||||
begin
|
||||
# Licese File Creation
|
||||
f = File.open("config/license.yml", "w")
|
||||
f.write("iv_key: #{response_data['iv_key']}\n")
|
||||
f.write("shop_name: #{response_data['shop_name']}\n")
|
||||
f.write("email: #{response_data['email']}\n")
|
||||
f.write("telephone: #{response_data['telephone']}\n")
|
||||
f.write("fax: #{response_data['fax']}\n")
|
||||
f.write("address: #{response_data['address']}\n")
|
||||
f.write("dbhost: #{response_data['dbhost']}\n")
|
||||
f.write("dbschema: #{response_data['dbschema']}\n")
|
||||
f.write("dbusername: #{response_data['dbusername']}\n")
|
||||
f.write("dbpassword: #{response_data['dbpassword']}\n")
|
||||
f.write("api_token: #{response_data['api_token']}\n")
|
||||
f.write("app_token: #{response_data['app_token']}\n")
|
||||
f.close
|
||||
rescue IOError
|
||||
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
||||
end
|
||||
response = { "status": true, "message": "Success Activation. License also created."}
|
||||
end
|
||||
|
||||
# Symmetric Configuration
|
||||
def create_symmetric_config(sym_location, db_host, db_schema, db_user, db_password)
|
||||
if File.directory? (sym_location)
|
||||
begin
|
||||
# sx properties create
|
||||
f = File.open(sym_location + "engines/sx.properties", "w")
|
||||
f.write("engine.name=sx\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n")
|
||||
f.write("db.user=#{db_user}\n")
|
||||
f.write("db.password=#{db_password}\n")
|
||||
f.write("registration.url=\n")
|
||||
f.write("sync.url=http://#{db_host}:31415/sync/sx\n")
|
||||
f.write("group.id=sx\n")
|
||||
f.write("external.id=000\n")
|
||||
f.write("job.purge.period.time.ms=7200000\n")
|
||||
f.write("job.routing.period.time.ms=5000\n")
|
||||
f.write("job.push.period.time.ms=10000\n")
|
||||
f.write("job.pull.period.time.ms=10000\n")
|
||||
f.write("initial.load.create.first=true\n")
|
||||
f.write("initial.load.use.extract.job.enabled=true\n")
|
||||
f.close
|
||||
|
||||
# read from license file
|
||||
shop_name = read_license("shop_name")
|
||||
dbhost = read_license("dbhost")
|
||||
dbschema = read_license("dbschema")
|
||||
dbusername = read_license("dbusername")
|
||||
dbpassword = read_license("dbpassword")
|
||||
|
||||
# shop properties create
|
||||
f = File.open(sym_location + "/#{shop_name}.properties", "w")
|
||||
f.write("engine.name=#{shop_name}\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{dbhost}/#{dbschema}?tinyInt1isBit=false\n")
|
||||
f.write("db.user=#{dbusername}\n")
|
||||
f.write("db.password=#{dbpassword}\n")
|
||||
f.write("registration.url=http://#{db_host}:31415/sync/sx\n")
|
||||
f.write("group.id=store\n")
|
||||
f.write("external.id=001\n")
|
||||
f.write("job.routing.period.time.ms=5000\n")
|
||||
f.write("job.push.period.time.ms=10000\n")
|
||||
f.write("job.pull.period.time.ms=10000\n")
|
||||
# f.write("initial.load.create.first=true\n")
|
||||
# f.write("initial.load.use.extract.job.enabled=true\n")
|
||||
f.close
|
||||
rescue IOError
|
||||
response = { "status": false, "message": "Activation is success but something is wrong. \n Please contact code2lab call center!"}
|
||||
end
|
||||
response = { "status": true, "message": "Success Activation. License also created."}
|
||||
end
|
||||
end
|
||||
|
||||
# Run Symmetric
|
||||
def run_symmetric(sym_path)
|
||||
check_sym_proc_str = `#{sym_path + "bin/sym_service status"}`
|
||||
check_sym_proc_str = check_sym_proc_str.split("\n")
|
||||
sym_install_status = check_sym_proc_str[0].split(": ")
|
||||
# sym_run_status = check_sym_proc_str[1].split(": ")
|
||||
|
||||
# Check Sym Installed
|
||||
if sym_install_status[1] == "false"
|
||||
response = { "status": false, "message": "Activation is success but Symmetric service not Installed. \n Please contact code2lab call center!"}
|
||||
end
|
||||
|
||||
# Run Sym Service
|
||||
sym_run_status = check_sym_running(check_sym_proc_str[1], sym_path)
|
||||
if sym_run_status
|
||||
# Create Sym Table
|
||||
check_sym_table = system(sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||
if check_sym_table
|
||||
sym_sql = Rails.root + "db/sym_master.sql"
|
||||
if File.exist? (sym_sql)
|
||||
# Import Sym Sql to db and start sym
|
||||
run_sym_sql = system(sym_path + "bin/dbimport --engine sx " + sym_sql)
|
||||
run_sym = system(sym_path + "bin/sym")
|
||||
if run_sym
|
||||
response = { "status": true, "message": "Activation is success and Configuration done..."}
|
||||
end
|
||||
else
|
||||
response = { "status": false, "message": "Activation is success but Symmetric Sql not Found. \n Please contact code2lab call center!"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Check Symmetric Running
|
||||
def check_sym_running(status, sym_path)
|
||||
# Run Sym Service
|
||||
if status.include? "Server is already running"
|
||||
return true
|
||||
elsif status.include? "false"
|
||||
sym_start_str = `#{sym_path + "bin/sym_service start"}`
|
||||
if sym_start_str.include? "Started"
|
||||
return true
|
||||
else
|
||||
check_sym_running(sym_start_status[0])
|
||||
end
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
# Delete License File
|
||||
def delete_license_file
|
||||
File.delete("config/license.yml") if File.exist?("config/license.yml")
|
||||
end
|
||||
|
||||
# Assign db info for Cloud
|
||||
def assign
|
||||
# self.name = @license["name"]
|
||||
# self.address_1 = @license["address_1"]
|
||||
@@ -228,17 +311,24 @@ class License
|
||||
## 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"]
|
||||
# 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)
|
||||
key = Base64.decode64(ENV['AES_KEY'])
|
||||
iv = Base64.decode64(ENV['AES_IV'])
|
||||
|
||||
if (@license["dbhost"] || @license["dbschema"] || @license["dbusername"] || @license["dbpassword"] )
|
||||
host = Base64.decode64(@license["dbhost"])
|
||||
dbschema = Base64.decode64(@license["dbschema"])
|
||||
dbusername = Base64.decode64(@license["dbusername"])
|
||||
dbpassword = Base64.decode64(@license["dbpassword"])
|
||||
|
||||
self.dbhost = AESCrypt.decrypt_data(host, key, iv, ENV['CIPHER_TYPE'])
|
||||
self.dbschema = AESCrypt.decrypt_data(dbschema, key, iv, ENV['CIPHER_TYPE'])
|
||||
self.dbusername = AESCrypt.decrypt_data(dbusername, key, iv, ENV['CIPHER_TYPE'])
|
||||
self.dbpassword = AESCrypt.decrypt_data(dbpassword, key, iv, ENV['CIPHER_TYPE'])
|
||||
end
|
||||
|
||||
# self.exchange_unqiue_id = @license["exchange_unqiue_id"]
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
require 'openssl'
|
||||
require 'base64'
|
||||
|
||||
class MyAesCrypt
|
||||
@cipher = ""
|
||||
|
||||
@@ -7,11 +10,16 @@ class MyAesCrypt
|
||||
|
||||
def export_key(passphrase)
|
||||
# We want a 256 bit key symetric key based on passphrase
|
||||
# for cloud is lookup
|
||||
# for local is license_key
|
||||
# iv_salt = passphrase+"c2l"
|
||||
digest = Digest::SHA256.new
|
||||
key = digest.update(passphrase)
|
||||
key = digest.digest
|
||||
ENV['AES_KEY'] = cipher_key = key # stores the key in key, and also sets the generated key on the @cipher
|
||||
ENV['AES_IV'] = cipher_iv = @cipher.random_iv # stores the iv in iv, and also sets the generated iv on the @cipher
|
||||
key_digest = digest.update(passphrase)
|
||||
# iv_digest = digest.update(iv_salt)
|
||||
key = key_digest.digest
|
||||
# iv = iv_digest.digest
|
||||
ENV['AES_KEY'] = cipher_key = Base64.encode64(key) # stores the key in key, and also sets the generated key on the @cipher
|
||||
ENV['AES_IV'] = cipher_iv = Base64.encode64(@cipher.random_iv) # stores the iv in iv, and also sets the generated iv on the @cipher
|
||||
return cipher_key, cipher_iv
|
||||
end
|
||||
|
||||
|
||||
@@ -363,18 +363,18 @@ class Order < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(filter,from,to,count)
|
||||
if count.to_i > 0
|
||||
item_count = "and item_count = '#{count}'"
|
||||
def self.search(filter,from,to)
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
item_count = ''
|
||||
keyword = "order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%"
|
||||
end
|
||||
if from.present? && to.present?
|
||||
Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ? #{item_count}", from,to)
|
||||
elsif !from.present? && !to.present? && count.present?
|
||||
Order.where("item_count = '#{count}'")
|
||||
|
||||
if from.present? && to.present?
|
||||
order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to)
|
||||
query = order.where(keyword)
|
||||
else
|
||||
Order.where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PrintSetting < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height
|
||||
validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies
|
||||
end
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(print_settings,oqs,order_id, item_code, print_status, options="")
|
||||
def print_order_item(print_settings,oqs,order_id, instance_code, print_status, options="")
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_item = print_query('order_item', instance_code) #OrderItem.find_by_item_code(item_code)
|
||||
|
||||
filename = "tmp/order_item.pdf"
|
||||
|
||||
@@ -14,12 +20,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
# end
|
||||
@@ -29,9 +36,14 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
def print_order_summary(print_settings,oqs, order_id, order_items, print_status)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order=print_query('order_summary', order_id)
|
||||
#Print
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order=print_query('order_summary', order_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
order.each do|odi|
|
||||
@@ -44,11 +56,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#end
|
||||
@@ -59,12 +72,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
self.print(filename, oqs.printer_name)
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
@@ -72,6 +86,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# Print for orders in booking
|
||||
def print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order=print_query('booking_summary', booking_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -89,9 +109,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#end
|
||||
@@ -105,9 +127,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
#For print copy
|
||||
pdf.render_file filename.gsub(".","-copy.")
|
||||
self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
else
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,6 @@ class Printer::PrinterWorker
|
||||
end
|
||||
|
||||
def print(file_path,printer_destination = nil )
|
||||
|
||||
if printer_destination.nil?
|
||||
printer_destination = self.printer_destination
|
||||
end
|
||||
|
||||
@@ -74,6 +74,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
# print as print copies in printer setting
|
||||
count = printer_settings.print_copies
|
||||
|
||||
# override print copies for print worker loop
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
begin
|
||||
if count == 1
|
||||
pdf.render_file "tmp/receipt_bill_#{sale_data.receipt_no}.pdf"
|
||||
@@ -100,7 +104,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = QueueNoPdf.new(printer_settings,queue)
|
||||
pdf.render_file "tmp/print_queue_no.pdf"
|
||||
pdf.render_file "tmp/print_queue_no.pdf"
|
||||
self.print("tmp/print_queue_no.pdf")
|
||||
end
|
||||
|
||||
|
||||
@@ -449,7 +449,7 @@ class Sale < ApplicationRecord
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
|
||||
query = sale.where(keyword)
|
||||
else
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -29,6 +29,7 @@ class SaleItem < ApplicationRecord
|
||||
def self.update_existing_item(qty, item, sale_id, type, item_price, price)
|
||||
sale_item = SaleItem.new
|
||||
sale_item.product_code = item.product_code
|
||||
sale_item.item_instance_code = item.item_instance_code
|
||||
sale_item.product_name = item.product_name + "(#{type})"
|
||||
sale_item.product_alt_name = item.product_alt_name
|
||||
sale_item.account_id = item.account_id
|
||||
@@ -145,17 +146,6 @@ class SaleItem < ApplicationRecord
|
||||
return price,type
|
||||
end
|
||||
|
||||
# Check for Card Payment
|
||||
def self.get_sale_payments_by_card(sale_payments)
|
||||
|
||||
# Check for Card Payment
|
||||
sale_payments.each do |sp|
|
||||
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
|
||||
return true;
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
# def self.get_overall_discount(sale_id)
|
||||
# price = 0.0
|
||||
# item=SaleItem.where("product_code=?", sale_id)
|
||||
@@ -170,6 +160,5 @@ class SaleItem < ApplicationRecord
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI")
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -155,6 +155,16 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
# Check for Card Payment
|
||||
def self.get_sale_payments_by_card(sale_payments)
|
||||
# Check for Card Payment
|
||||
sale_payments.each do |sp|
|
||||
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
|
||||
return true;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def cash_payment
|
||||
payment_status = false
|
||||
@@ -497,8 +507,6 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||
|
||||
@@ -5,7 +5,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.margin = 5
|
||||
self.price_width = 40
|
||||
self.price_width = 60
|
||||
self.qty_width = 20
|
||||
self.total_width = 40
|
||||
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
||||
@@ -133,7 +133,6 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.cash_in}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash Out:", :size => self.item_font_size, :align => :right
|
||||
@@ -142,26 +141,11 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.cash_out}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Net Sales:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.nett_sales}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Tax :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
@total_foc = 0
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -180,14 +164,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
#start other payment details
|
||||
if shift_sale.other_sales > 0
|
||||
other_payment.each do |other|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Other Payment Details", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
@total_foc = other.foc_amount.round(2)
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "MPU Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -204,14 +181,6 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{other.visa_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Master Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -220,6 +189,14 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{other.master_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "JCB Payment :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.jcb_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Reedem Payment :", :size => self.item_font_size, :align => :right
|
||||
@@ -227,15 +204,6 @@ class CloseCashierPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.paypar_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "FOC :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{other.foc_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
y_position = cursor
|
||||
@@ -247,22 +215,54 @@ class CloseCashierPdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Rounding Adjustments :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_rounding.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.grand_total.round(2)}", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
|
||||
# end other payment details
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
|
||||
#start service charges and commercial tax
|
||||
sale_taxes.each do |tax|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total #{amount.account_name} Amount:", :size => self.item_font_size, :align => :right
|
||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||
text "#{tax.st_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Taxes :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Net Sales :", :style => :bold, :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.nett_sales}", :style => :bold , :size => self.header_font_size - 1, :align => :right
|
||||
end
|
||||
#end for service charges and commercial tax
|
||||
#COMMENTED FOR NO NEED AND NOT CORRECT WHEN OTHER CHARGES
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
@@ -305,47 +305,66 @@ class CloseCashierPdf < Prawn::Document
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Overall Discount :", :size => self.item_font_size, :align => :right
|
||||
text "Total Discount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{@overall}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total FOC :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{@total_foc})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Discount Amount :", :size => self.item_font_size, :align => :right
|
||||
text "Total Void :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
|
||||
text "(#{shift_sale.total_void})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
# text "Grand Total :", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
move_down 7
|
||||
|
||||
sale_taxes.each do |tax|
|
||||
|
||||
#start total amount by Account Like Food / Beverage /..
|
||||
total_amount_by_account.each do |amount|
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "#{tax.tax_name} :", :size => self.item_font_size, :align => :right
|
||||
text "Total #{amount.account_name} Amount :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{tax.st_amount.round(2)}", :size => self.item_font_size, :align => :right
|
||||
text "#{amount.total_price.round(2)} ", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Rounding Adjustment :", :size => self.item_font_size, :align => :right
|
||||
text "Total Dine-in Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_rounding.round(2)}", :size => self.item_font_size, :align => :right
|
||||
text "#{shift_sale.dining_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
y_position = cursor
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Grand Total :", :size => self.item_font_size, :align => :right
|
||||
text "Total Takeaway Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
|
||||
text "#{shift_sale.takeaway_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
@@ -356,31 +375,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.total_receipt}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Dining Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.dining_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Takeaway Count :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.takeaway_count}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Void:", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "(#{shift_sale.total_void})", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
move_down 5
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
move_down 5
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-9 col-md-9 col-sm-9">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
<div class="card">
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-hover table-striped">
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<div class="card">
|
||||
<div class="body" id="custom-slimscroll">
|
||||
<%= render 'new_form', crm_customer: @crm_customer, taxes: @taxes %>
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,9 +39,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,9 +49,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,9 +59,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,9 +69,9 @@
|
||||
<div class="row bottom">
|
||||
<div class="col-md-12 m-l--5">
|
||||
<div class="row m-l--5">
|
||||
<div class="col-md-3 left cashier_number"></div>
|
||||
<div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number"></div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 left-margin-1 cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
<%= link_to t("views.btn.new"),new_crm_dining_queue_path,:class => 'btn bg-green btn-block btn-lg btn-block', 'data-no-turbolink' => true %>
|
||||
<hr>
|
||||
|
||||
<button type="button" id="assign" class="btn btn-primary btn-block btn-lg waves-effect" disabled>Assign</button>
|
||||
<button type="button" id="cancel" class="btn btn-danger btn-block btn-lg waves-effect" disabled>Cancel</button>
|
||||
<button type="button" id="assign" class="btn btn-primary btn-block btn-lg waves-effect" style="font-size: 11px" disabled>Assign</button>
|
||||
<button type="button" id="cancel" class="btn btn-danger btn-block btn-lg waves-effect" style="font-size: 11px" disabled>Cancel</button>
|
||||
<!-- <a href="<%= dashboard_path %>" class="btn btn-default btn-block waves-effect" role="button" aria-haspopup="true" aria-expanded="false"> Back </a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
</button> -->
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print <br/>Order<br/>Summary</button> -->
|
||||
<button id="assign" value="" disabled="disabled" data-type="assign" class="btn assign btn-primary btn-lg btn-block">ASSIGN</button>
|
||||
<button id="cancel" value="" disabled="disabled" data-type="cancel" class="btn btn-danger cancel btn-lg btn-block">CANCLE</button>
|
||||
<button id="cancel" value="" disabled="disabled" data-type="cancel" class="btn btn-danger cancel btn-lg btn-block">CANCEL</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -144,16 +144,7 @@
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method == 'mpu' || payment.payment_method == 'visa' || payment.payment_method == 'master' || payment.payment_method == 'jcb' %>
|
||||
<tr>
|
||||
<td>Card Sale : </td>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<%= data["card"] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
||||
<tr>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<td align="right">
|
||||
@@ -167,6 +158,16 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>Card Sale : </td>
|
||||
<td align="right">
|
||||
<% total_card = 0.0 %>
|
||||
<% @sale_data.each do |data| %>
|
||||
<% total_card = data["card"] %>
|
||||
<% break end %>
|
||||
<%= total_card.to_f %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form action="/install" method="POST" class="row">
|
||||
<form action="/activate" method="POST" class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Business Name</label>
|
||||
@@ -10,7 +10,7 @@
|
||||
<input type="text" class="form-control" name="license_key" aria-describedby="license_key" placeholder="Add License Key">
|
||||
<small class="form-text text-muted">Add License Key from Email</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<!-- <div class="form-group">
|
||||
<label for="lblAdministrator">Administrator Username</label>
|
||||
<input type="text" class="form-control" name="admin_user" aria-describedby="admin_user" placeholder="Administrator Username">
|
||||
<small id="admin_user" class="form-text text-muted">First Employee who will be assign as administrator</small>
|
||||
@@ -18,9 +18,17 @@
|
||||
<div class="form-group">
|
||||
<label for="admin_password">Password</label>
|
||||
<input type="password" class="form-control" name="admin_password" placeholder="Password">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="lblDBHost">Database Host</label>
|
||||
<input type="text" class="form-control" name="db_host" aria-describedby="db_host" placeholder="Database Host" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lblDBName">Database Schema</label>
|
||||
<input type="text" class="form-control" name="db_schema" aria-describedby="db_schema" placeholder="Database Schema">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lblAdministrator">Database Username</label>
|
||||
<input type="text" class="form-control" name="db_user" aria-describedby="db_user" placeholder="Database Username">
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<%if current_login_employee.role !="waiter" %>
|
||||
<p class="delete waves-effect waves-block p-l-30 m-t-15" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons">exit_to_app</i>
|
||||
<span class="font-18 m-b-5">Logout</span>
|
||||
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
|
||||
<i class="material-icons font-10 logout_icon">exit_to_app</i>
|
||||
<span class="font-18">Logout</span>
|
||||
</p>
|
||||
<span class="hidden" id="delete_text">
|
||||
<h6>Are you sure you want to Logout ?</h6>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 p-t-20 p-l-10 p-r-10 p-b-50 bg-white">
|
||||
<div class="row justify-content-center form-group">
|
||||
<!-- <span class="col-md-4"></span> -->
|
||||
<input type="text" class="form-control col-4" id="emp_id" onkeypress="empID()" placeholder="Access PIN">
|
||||
<input type="text" class="form-control col-4" id="emp_id" onkeypress="empID()" placeholder="Employee ID">
|
||||
<!-- <span class="col-md-4"></span> -->
|
||||
</div>
|
||||
|
||||
|
||||
@@ -40,15 +40,13 @@
|
||||
<!-- </div> -->
|
||||
<% end %>
|
||||
<!-- <div class="row"> -->
|
||||
<div class="row">
|
||||
<!-- <div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<label >Recent Credit Amount</label>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div> -->
|
||||
<!-- </div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/member_discount",
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':false },
|
||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
|
||||
// success:function(result){
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
<%= f.input :print_copies %>
|
||||
<%= f.input :print_copies, input_html: { min: '1', step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
|
||||
<%= f.input :precision %>
|
||||
<%= f.input :delimiter %>
|
||||
<%= f.input :heading_space %>
|
||||
@@ -58,4 +58,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function greaterThanOne(val){
|
||||
if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
|
||||
}
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="p-l-15">
|
||||
<%= 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 %>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="">Select Date Range</label>
|
||||
@@ -12,17 +12,17 @@
|
||||
<% end %>
|
||||
</div> -->
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
</div>
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t :commissioner %></label>
|
||||
<select class="form-control" name="commissioner" id="commissioner">
|
||||
<select class="form-control" name="commissioner" id="commissioner" style="height: 37px;">
|
||||
<option value=""></option>
|
||||
<% @commissioner.each do |c| %>
|
||||
<% if @com_id == c.id %>
|
||||
@@ -34,16 +34,16 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20">
|
||||
<br>
|
||||
<br>
|
||||
<input type="submit" value="Generate Report" class='btn btn-info wave-effects'>
|
||||
</div>
|
||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2 margin-top-20">
|
||||
<input type="button" value="Clear Filter" id="clear_filter" class='btn btn-danger'>
|
||||
</div> -->
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- <script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<div class="form-group col-md-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-20">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="font-20">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label class="font-20">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" style="height: 37px;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-1 ">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
<div class="page-header">
|
||||
<div class="page-header" style="width:117%;">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.daily_sale_report") %></li>
|
||||
@@ -10,7 +10,6 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
||||
|
||||
<%= render :partial=>'shift_sale_report_filter',
|
||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||
<hr />
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card ">
|
||||
<div class="card" style="width:117%;">
|
||||
<div class="body table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 from" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3 to" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.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" style="height: 37px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 33.5px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 33.5;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.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" style="height: 36px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="font-14">Select Shift Period</label> -->
|
||||
<label class="font-14"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-14"><%= t("views.right_panel.detail.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" style="height: 37px;" >
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 margin-top-20"><br>
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-14">From</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 35px;">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-14">To</label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 35px;">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="font-14">Definition Item</label>
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<div class="form-group col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- <label class="">Select Shift Period</label> -->
|
||||
<label class="font-20"><%= t("views.right_panel.detail.from") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="from" id="from" type="text" placeholder="From date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-lg-2 col-md-2 col-sm-2">
|
||||
<label class="font-20"><%= t("views.right_panel.detail.to") %></label>
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date">
|
||||
<input data-behaviour='datepicker' class="form-control datepicker m-t-3" name="to" id="to" type="text" placeholder="To date" style="height: 34px;">
|
||||
</div>
|
||||
<div class="form-group col-lg-3 col-md-3 col-sm-3">
|
||||
<label class="font-20"><%= t("views.right_panel.detail.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" style="height: 37px;">
|
||||
</select>
|
||||
</div>
|
||||
<div class=" col-lg-1 col-md-1 col-sm-1 margin-top-20">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<%= f.input :item_instance_name %>
|
||||
<%= f.input :price %>
|
||||
|
||||
<%= f.input :item_attributes, collection: @item.item_attributes, input_html: { multiple: true } %>
|
||||
<%= f.input :item_attributes, collection: @item.item_attributes, include_blank: false, include_hidden: false%>
|
||||
|
||||
<%= f.input :is_on_promotion %>
|
||||
<%= f.input :promotion_price %>
|
||||
|
||||
@@ -106,39 +106,39 @@
|
||||
</div>
|
||||
-->
|
||||
<div class="row">
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% arr = MenuItem.active.joins("JOIN menu_item_instances as b ON b.menu_item_id=menu_items.id").group("menu_items.id").order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3 form-group">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place">
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@promotion.original_product) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @promotion.original_product %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@promotion.original_product) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @promotion.original_product %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<option value="" selected>Choose Something</option>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3 form-group"><%= f.input :original_product,collection: sample %></div>
|
||||
<!-- <div class="col-md-6"><%= f.input :original_product,collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
|
||||
@@ -160,7 +160,7 @@
|
||||
<%= f.fields_for :promotion_products do |pro| %>
|
||||
<div class="row">
|
||||
<%= pro.hidden_field :item_code,:class => "promo_product" %>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% arr = MenuItem.joins("JOIN menu_item_instances as b ON b.menu_item_id=menu_items.id").group("menu_items.id").order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
@@ -247,9 +247,10 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
if(($('.item_code_place').val()!=undefined) && ($('.item_code_place').val()!="")){
|
||||
getItemInstance($('.item_code_place').val());
|
||||
}
|
||||
|
||||
$('#promotion_promo_start_hour').on('change', function(event) {
|
||||
$('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
|
||||
@@ -273,7 +274,7 @@
|
||||
});
|
||||
|
||||
var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
|
||||
jQuery.each( dayy.split(","), function( i, d ) {
|
||||
$.each( dayy.split(","), function( i, d ) {
|
||||
$("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||
});
|
||||
|
||||
@@ -324,8 +325,13 @@
|
||||
// $(".item_code_place").select2();
|
||||
|
||||
$(".item_code_place").on('change', function(event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
getItemInstance(item_code);
|
||||
});
|
||||
|
||||
function getItemInstance(item_code) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var original_product = "<%= @promotion.original_product %>";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
@@ -334,13 +340,15 @@
|
||||
$("#promotion_original_product").empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
var selected = "";
|
||||
if(original_product == result[i][1]) selected = "selected";
|
||||
itemlist += "<option value ="+result[i][1]+" "+selected+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#promotion_original_product").append(itemlist);
|
||||
//$("#promotion_original_product").select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//$(".promotion_promotion_products_item_code select").select2();
|
||||
//$(".item_code_place1").select2();
|
||||
@@ -356,7 +364,7 @@
|
||||
|
||||
// for promotion products data showing
|
||||
var promopdt = $(".promo_product");
|
||||
jQuery.each( promopdt, function( i, ppdt ) {
|
||||
$.each( promopdt, function( i, ppdt ) {
|
||||
var ajax_url = "<%= settings_find_parent_item_path %>";
|
||||
var item_code = ppdt.value;
|
||||
var select_id = ppdt.id;
|
||||
@@ -365,14 +373,33 @@
|
||||
url: ajax_url,
|
||||
data: 'item_instance_code=' + item_code,
|
||||
success: function (result) {
|
||||
// console.log(result);
|
||||
var par_item_code = "";
|
||||
var arr_item_inst = "";
|
||||
if((result[0]!=undefined) && (result[0]!="")){
|
||||
$.each(result[0],function(k,val){
|
||||
par_item_code = k;
|
||||
arr_item_inst = val;
|
||||
});
|
||||
}
|
||||
|
||||
if(result.length > 0){
|
||||
$("select#"+select_id).empty();
|
||||
$("select#"+select_id).append("<option value='"+item_code+"'>"+result[0]+"</option>");
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+result[1]+"']").attr("selected","true")
|
||||
var iteminstlists;
|
||||
$.each(arr_item_inst,function(k2,v2al){
|
||||
$("select#"+select_id).empty();
|
||||
var selected = "";
|
||||
$.each(v2al,function(k3,v3al){
|
||||
if(k3 == item_code) selected = "selected";
|
||||
iteminstlists += "<option value='"+k3+"' "+selected+">"+v3al+"</option>";
|
||||
});
|
||||
});
|
||||
$("select#"+select_id).append(iteminstlists);
|
||||
|
||||
$("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+par_item_code+"']").attr("selected","true")
|
||||
// $("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// promotion_promotion_products_attributes_0_item_code
|
||||
@@ -394,8 +421,8 @@
|
||||
}
|
||||
$("select#"+id).append(itemlist);
|
||||
//$("select#"+id).select2();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.input :item_code,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :alt_name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"},:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"},:input_html => {:class => "col-md-9"}, include_blank: false, include_hidden: false %>
|
||||
<%= f.input :min_qty,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :account_id, :label => "Account type", :collection => Account.collection,:input_html => {:class => "col-md-9"} %>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<%= f.input :item_code,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :alt_name,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :type, :collection => ["SimpleMenuItem","SetMenuItem"], :input_html => {:class => "col-md-9"}, include_blank: false, include_hidden: false %>
|
||||
<%= f.input :min_qty,:input_html => {:class => "col-md-9"} %>
|
||||
<%= f.input :account_id, :label => "Account type", :collection => Account.collection,:input_html => {:class => "col-md-9"} %>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
|
||||
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
|
||||
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="" style="margin-right: 10px">
|
||||
<input type="text" id="receipt_no" name="receipt_no" class="form-control" placeholder="Booking/Sale ID" style="margin-right: 10px">
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
|
||||
<label class=""><%= t("views.right_panel.detail.from") %></label>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<td><%=shift_sale.cashier_terminal.name%></td>
|
||||
<td><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
|
||||
</td>
|
||||
<td><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') rescue '-' %>
|
||||
<td><%= shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') rescue '-' %>
|
||||
</td>
|
||||
<td><%=shift_sale.opening_balance %></td>
|
||||
<td><%=shift_sale.closing_balance %></td>
|
||||
|
||||
Reference in New Issue
Block a user