fixed conflix after pull split bill
This commit is contained in:
60
Gemfile.lock
60
Gemfile.lock
@@ -53,7 +53,7 @@ GEM
|
|||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
bindex (0.5.0)
|
bindex (0.5.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (10.0.0)
|
byebug (9.1.0)
|
||||||
cancancan (1.17.0)
|
cancancan (1.17.0)
|
||||||
capistrano (3.10.1)
|
capistrano (3.10.1)
|
||||||
airbrussh (>= 1.0.0)
|
airbrussh (>= 1.0.0)
|
||||||
@@ -66,7 +66,7 @@ GEM
|
|||||||
capistrano-rails (1.3.1)
|
capistrano-rails (1.3.1)
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
capistrano-bundler (~> 1.1)
|
capistrano-bundler (~> 1.1)
|
||||||
carrierwave (1.2.2)
|
carrierwave (1.2.1)
|
||||||
activemodel (>= 4.0.0)
|
activemodel (>= 4.0.0)
|
||||||
activesupport (>= 4.0.0)
|
activesupport (>= 4.0.0)
|
||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
@@ -81,7 +81,7 @@ GEM
|
|||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
connection_pool (2.2.1)
|
connection_pool (2.2.1)
|
||||||
crass (1.0.3)
|
crass (1.0.2)
|
||||||
cups (0.1.10)
|
cups (0.1.10)
|
||||||
database_cleaner (1.6.2)
|
database_cleaner (1.6.2)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
@@ -92,17 +92,17 @@ GEM
|
|||||||
factory_girl_rails (4.9.0)
|
factory_girl_rails (4.9.0)
|
||||||
factory_girl (~> 4.9.0)
|
factory_girl (~> 4.9.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faker (1.8.7)
|
faker (1.8.4)
|
||||||
i18n (>= 0.7)
|
i18n (~> 0.5)
|
||||||
ffi (1.9.18)
|
ffi (1.9.18)
|
||||||
filterrific (5.0.1)
|
filterrific (2.1.2)
|
||||||
font-awesome-rails (4.7.0.3)
|
font-awesome-rails (4.7.0.2)
|
||||||
railties (>= 3.2, < 5.2)
|
railties (>= 3.2, < 5.2)
|
||||||
globalid (0.4.1)
|
globalid (0.4.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
httparty (0.15.6)
|
httparty (0.15.6)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
i18n (0.9.3)
|
i18n (0.9.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
jbuilder (2.7.0)
|
jbuilder (2.7.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
@@ -142,32 +142,32 @@ GEM
|
|||||||
mini_magick (4.8.0)
|
mini_magick (4.8.0)
|
||||||
mini_mime (1.0.0)
|
mini_mime (1.0.0)
|
||||||
mini_portile2 (2.3.0)
|
mini_portile2 (2.3.0)
|
||||||
minitest (5.11.3)
|
minitest (5.10.3)
|
||||||
momentjs-rails (2.17.1)
|
momentjs-rails (2.17.1)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
multi_json (1.13.1)
|
multi_json (1.12.2)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
mysql2 (0.4.10)
|
mysql2 (0.4.9)
|
||||||
nested_form (0.3.2)
|
nested_form (0.3.2)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (4.2.0)
|
net-ssh (4.2.0)
|
||||||
nio4r (2.2.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.8.2)
|
nokogiri (1.8.1)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.3.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pg (1.0.0)
|
pg (0.21.0)
|
||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
prawn-table (0.2.2)
|
prawn-table (0.2.2)
|
||||||
prawn (>= 1.3.0, < 3.0.0)
|
prawn (>= 1.3.0, < 3.0.0)
|
||||||
puma (3.11.2)
|
puma (3.10.0)
|
||||||
rack (2.0.4)
|
rack (2.0.3)
|
||||||
rack-cors (1.0.2)
|
rack-cors (1.0.2)
|
||||||
rack-protection (2.0.0)
|
rack-protection (2.0.0)
|
||||||
rack
|
rack
|
||||||
rack-test (0.8.2)
|
rack-test (0.7.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (5.1.4)
|
rails (5.1.4)
|
||||||
actioncable (= 5.1.4)
|
actioncable (= 5.1.4)
|
||||||
@@ -192,12 +192,12 @@ GEM
|
|||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rake (12.3.0)
|
rake (12.2.1)
|
||||||
rb-fsevent (0.10.2)
|
rb-fsevent (0.10.2)
|
||||||
rb-inotify (0.9.10)
|
rb-inotify (0.9.10)
|
||||||
ffi (>= 0.5.0, < 2)
|
ffi (>= 0.5.0, < 2)
|
||||||
redis (3.3.5)
|
redis (3.3.5)
|
||||||
rspec-core (3.7.1)
|
rspec-core (3.7.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-expectations (3.7.0)
|
rspec-expectations (3.7.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
@@ -205,7 +205,7 @@ GEM
|
|||||||
rspec-mocks (3.7.0)
|
rspec-mocks (3.7.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-rails (3.7.2)
|
rspec-rails (3.7.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
@@ -213,14 +213,14 @@ GEM
|
|||||||
rspec-expectations (~> 3.7.0)
|
rspec-expectations (~> 3.7.0)
|
||||||
rspec-mocks (~> 3.7.0)
|
rspec-mocks (~> 3.7.0)
|
||||||
rspec-support (~> 3.7.0)
|
rspec-support (~> 3.7.0)
|
||||||
rspec-support (3.7.1)
|
rspec-support (3.7.0)
|
||||||
ruby-ole (1.2.12.1)
|
ruby-ole (1.2.12.1)
|
||||||
sass (3.5.5)
|
sass (3.5.3)
|
||||||
sass-listen (~> 4.0.0)
|
sass-listen (~> 4.0.0)
|
||||||
sass-listen (4.0.0)
|
sass-listen (4.0.0)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
sass-rails (5.0.7)
|
sass-rails (5.0.6)
|
||||||
railties (>= 4.0.0, < 6)
|
railties (>= 4.0.0, < 6)
|
||||||
sass (~> 3.1)
|
sass (~> 3.1)
|
||||||
sprockets (>= 2.8, < 4.0)
|
sprockets (>= 2.8, < 4.0)
|
||||||
@@ -238,7 +238,7 @@ GEM
|
|||||||
simple_form (3.5.0)
|
simple_form (3.5.0)
|
||||||
actionpack (> 4, < 5.2)
|
actionpack (> 4, < 5.2)
|
||||||
activemodel (> 4, < 5.2)
|
activemodel (> 4, < 5.2)
|
||||||
spreadsheet (1.1.5)
|
spreadsheet (1.1.4)
|
||||||
ruby-ole (>= 1.0)
|
ruby-ole (>= 1.0)
|
||||||
spring (2.0.2)
|
spring (2.0.2)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
@@ -263,12 +263,12 @@ GEM
|
|||||||
to_xls-rails (1.3.1)
|
to_xls-rails (1.3.1)
|
||||||
spreadsheet (>= 0.8.5)
|
spreadsheet (>= 0.8.5)
|
||||||
ttfunk (1.5.1)
|
ttfunk (1.5.1)
|
||||||
turbolinks (5.1.0)
|
turbolinks (5.0.1)
|
||||||
turbolinks-source (~> 5.1)
|
turbolinks-source (~> 5)
|
||||||
turbolinks-source (5.1.0)
|
turbolinks-source (5.0.3)
|
||||||
tzinfo (1.2.4)
|
tzinfo (1.2.4)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.1.5)
|
uglifier (3.2.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
web-console (3.5.1)
|
web-console (3.5.1)
|
||||||
actionview (>= 5.0)
|
actionview (>= 5.0)
|
||||||
@@ -277,8 +277,8 @@ GEM
|
|||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
websocket-driver (0.6.5)
|
websocket-driver (0.6.5)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.3)
|
websocket-extensions (0.1.2)
|
||||||
whenever (0.10.0)
|
whenever (0.9.7)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ SQL Update after rake clear:data runned
|
|||||||
Change type in mysql
|
Change type in mysql
|
||||||
*run if you got font error for Myanmar, Chinese, etc...
|
*run if you got font error for Myanmar, Chinese, etc...
|
||||||
=> ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table
|
=> ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table
|
||||||
=> ALTER DATABASE [database_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database
|
=> ALTER DATABASE [database_name] CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database
|
||||||
|
|
||||||
For split bill
|
For split bill
|
||||||
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
||||||
|
|||||||
@@ -27,40 +27,37 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
# bookings = Booking.all
|
bookings = Booking.all
|
||||||
# if !bookings.nil?
|
if !bookings.today.nil?
|
||||||
# @order_items_count = Hash.new
|
@order_items_count = Hash.new
|
||||||
# bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
# if !booking.booking_orders.empty?
|
if !booking.booking_orders.empty?
|
||||||
# booking.booking_orders.each do |booking_order|
|
booking.booking_orders.each do |booking_order|
|
||||||
# order = Order.find(booking_order.order_id)
|
order = Order.find(booking_order.order_id)
|
||||||
# if !order.order_items.empty?
|
if !order.order_items.empty?
|
||||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
# @order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
# else
|
else
|
||||||
# @order_items_count[booking.dining_facility_id] += order.order_items.count
|
@order_items_count[booking.dining_facility_id] += order.order_items.count
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# else
|
else
|
||||||
# if !booking.sale_id.nil?
|
if !booking.sale_id.nil?
|
||||||
# sale = Sale.find(booking.sale_id)
|
sale = Sale.find(booking.sale_id)
|
||||||
# if sale.sale_status !='completed'
|
if sale.sale_status !='completed'
|
||||||
# if !@order_items_count.key?(booking.dining_facility_id)
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
# @order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
# else
|
else
|
||||||
# @order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
@order_items_count[booking.dining_facility_id] = sale.sale_items.count
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
puts "@order_items_count"
|
|
||||||
puts @order_items_count.to_json
|
|
||||||
|
|
||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@@ -126,12 +123,12 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
#for bank integration
|
#for bank integration
|
||||||
@checkout_time = Lookup.collection_of('checkout_time')
|
@checkout_time = Lookup.collection_of('checkout_time')
|
||||||
@checkout_alert_time = Lookup.collection_of('checkout_alert_time')
|
@checkout_alert_time = Lookup.collection_of('checkout_alert_time')
|
||||||
#for split bill
|
end
|
||||||
lookup_spit_bill = Lookup.collection_of('split_bill')
|
|
||||||
@spit_bill = 0
|
#Shop Name in Navbor
|
||||||
if !lookup_spit_bill[0].nil?
|
helper_method :shop_detail
|
||||||
@spit_bill = lookup_spit_bill[0][1]
|
def shop_detail
|
||||||
end
|
@shop = Shop.first
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -140,9 +137,4 @@ def set_dining
|
|||||||
@dining = DiningFacility.find(params[:dining_id])
|
@dining = DiningFacility.find(params[:dining_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
|
||||||
helper_method :shop_detail
|
|
||||||
def shop_detail
|
|
||||||
@shop = Shop.first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,23 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
@order = Order.find(params[:order_id])
|
@order = Order.find(params[:order_id])
|
||||||
|
booking = Booking.select('bookings.booking_id, bookings.dining_facility_id')
|
||||||
|
.joins(" JOIN booking_orders as bo on bo.booking_id = bookings.booking_id")
|
||||||
|
.where("bo.order_id='#{params[:order_id]}'").first()
|
||||||
|
|
||||||
|
@booking = Array.new
|
||||||
|
if !booking.nil?
|
||||||
|
dining_facilities = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||||
|
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => dining_facilities.type})
|
||||||
|
end
|
||||||
|
|
||||||
|
#for split bill
|
||||||
|
lookup_spit_bill = Lookup.collection_of('split_bill')
|
||||||
|
@split_bill = 0
|
||||||
|
if !lookup_spit_bill[0].nil?
|
||||||
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
|
end
|
||||||
|
|
||||||
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
sale_order = SaleOrder.find_by_order_id(@order.order_id)
|
||||||
if sale_order
|
if sale_order
|
||||||
unless sale_order.sale_id.nil?
|
unless sale_order.sale_id.nil?
|
||||||
@@ -12,9 +29,22 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
@sale_status = sale.sale_status
|
@sale_status = sale.sale_status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@order.order_items.each_with_index do |item, order_item_index|
|
||||||
|
if !item.set_menu_items.nil?
|
||||||
|
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||||
|
arr_instance_item_sets = Array.new
|
||||||
|
instance_item_sets.each do |instance_item|
|
||||||
|
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||||
|
arr_instance_item_sets.push(item_instance_name)
|
||||||
|
item.price = item.price.to_f + instance_item["price"].to_f
|
||||||
|
end
|
||||||
|
@order.order_items[order_item_index].set_menu_items = arr_instance_item_sets
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
bookings = Booking.all
|
bookings = Booking.all
|
||||||
if !bookings.nil?
|
if !bookings.today.nil?
|
||||||
@order_items_count = Hash.new
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
sale_data = Sale.find_by_sale_id(sale_id)
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||||
member_info = nil
|
member_info = nil
|
||||||
|
survey = Survey.find_by_receipt_no(sale_data.receipt_no)
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
# if bookings.count > 1
|
||||||
@@ -66,7 +67,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil,survey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
shop_details = Shop::ShopDetail
|
shop_details = Shop::ShopDetail
|
||||||
|
survey = Survey.find_by_receipt_no(saleObj.receipt_no)
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_details.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25 # Modulus
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
@@ -151,7 +153,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data,survey)
|
||||||
|
|
||||||
if params[:type] == "quick_service"
|
if params[:type] == "quick_service"
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
@@ -273,7 +275,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
member_info = nil
|
member_info = nil
|
||||||
|
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
survey = Survey.find_by_receipt_no(saleObj.receipt_no)
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
# if bookings.count > 1
|
||||||
@@ -326,7 +329,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data,survey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -340,7 +343,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
survey = Survey.find_by_receipt_no(saleObj.receipt_no)
|
||||||
|
|
||||||
if saleObj.discount_type == "member_discount"
|
if saleObj.discount_type == "member_discount"
|
||||||
saleObj.update_attributes(rounding_adjustment: 0)
|
saleObj.update_attributes(rounding_adjustment: 0)
|
||||||
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0)
|
saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0)
|
||||||
@@ -384,7 +388,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil,survey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
bookings = Booking.all
|
bookings = Booking.all
|
||||||
if !bookings.nil?
|
if !bookings.today.nil?
|
||||||
@order_items_count = Hash.new
|
@order_items_count = Hash.new
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@@ -125,9 +125,9 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
lookup_spit_bill = Lookup.collection_of('split_bill')
|
lookup_spit_bill = Lookup.collection_of('split_bill')
|
||||||
@spit_bill = 0
|
@split_bill = 0
|
||||||
if !lookup_spit_bill[0].nil?
|
if !lookup_spit_bill[0].nil?
|
||||||
@spit_bill = lookup_spit_bill[0][1]
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
|
|
||||||
if @booking
|
if @booking
|
||||||
@booking.booking_orders.each do |booking_order|
|
@booking.booking_orders.each do |booking_order|
|
||||||
|
arr_order_items = Array.new
|
||||||
@order = Order.find(booking_order.order_id)
|
@order = Order.find(booking_order.order_id)
|
||||||
if (@order.status == "new")
|
if (@order.status == "new")
|
||||||
@orders.push(@order)
|
@orders.push(@order)
|
||||||
@@ -28,12 +29,44 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
arr_instance_item_sets = Array.new
|
arr_instance_item_sets = Array.new
|
||||||
instance_item_sets.each do |instance_item|
|
instance_item_sets.each do |instance_item|
|
||||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||||
|
item.price = item.price.to_f + instance_item["price"].to_f
|
||||||
arr_instance_item_sets.push(item_instance_name)
|
arr_instance_item_sets.push(item_instance_name)
|
||||||
end
|
end
|
||||||
item.set_menu_items = arr_instance_item_sets
|
item.set_menu_items = arr_instance_item_sets
|
||||||
end
|
end
|
||||||
@order_items.push(item)
|
|
||||||
|
arr_item = Hash.new
|
||||||
|
if item.qty.to_i > 1
|
||||||
|
i = 1
|
||||||
|
while i <= item.qty.to_i do
|
||||||
|
arr_item = {'order_items_id' => item.order_items_id,
|
||||||
|
'order_id' => item.order_id,
|
||||||
|
'order_item_status' => item.order_item_status,
|
||||||
|
'item_order_by' => item.item_order_by,
|
||||||
|
'item_code' => item.item_code,
|
||||||
|
'item_instance_code' => item.item_instance_code,
|
||||||
|
'item_name' => item.item_name,
|
||||||
|
'alt_name' => item.alt_name,
|
||||||
|
'account_id' => item.account_id,
|
||||||
|
'qty' => '1.0',
|
||||||
|
'price' => item.price,
|
||||||
|
'remark' => item.remark,
|
||||||
|
'options' => item.options,
|
||||||
|
'set_menu_items' => item.set_menu_items,
|
||||||
|
'taxable' => item.taxable,
|
||||||
|
'completed_by' => item.completed_by,
|
||||||
|
'created_at' => item.created_at,
|
||||||
|
'updated_at' => item.updated_at}
|
||||||
|
i += 1
|
||||||
|
@order_items.push({@order.order_id => arr_item})
|
||||||
|
arr_order_items.push(arr_item)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
arr_order_items.push(item)
|
||||||
|
@order_items.push({@order.order_id => item})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@order_items.push({'all_order' => arr_order_items})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -116,6 +149,8 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
|
|
||||||
if !order_id.nil?
|
if !order_id.nil?
|
||||||
if order_id_count > 1
|
if order_id_count > 1
|
||||||
|
puts "order_id_count > 1"
|
||||||
|
|
||||||
updated_order_id = Array.new
|
updated_order_id = Array.new
|
||||||
order_ids.each do |odr_id|
|
order_ids.each do |odr_id|
|
||||||
odr = Order.find(odr_id)
|
odr = Order.find(odr_id)
|
||||||
@@ -124,6 +159,9 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "updated_order_id"
|
||||||
|
puts updated_order_id
|
||||||
|
|
||||||
if !updated_order_id.empty?
|
if !updated_order_id.empty?
|
||||||
order_ids.each do |odr_id|
|
order_ids.each do |odr_id|
|
||||||
unless updated_order_id.include?(odr_id)
|
unless updated_order_id.include?(odr_id)
|
||||||
@@ -134,30 +172,115 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
|
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
if updated_order_id.include?(order_item["order_id"])
|
if updated_order_id.include?(order_item["order_id"])
|
||||||
orderItem = OrderItem.find(order_item["id"])
|
update_order_item(order_id, order_item)
|
||||||
orderItem.order_id = order_id
|
|
||||||
orderItem.save!
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
order_ids.each do |odr_id|
|
order_ids.each do |odr_id|
|
||||||
BookingOrder.find_by_order_id(odr_id).delete
|
new_order_status = true
|
||||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => odr_id})
|
order_items.each do |order_item|
|
||||||
|
orderItem = OrderItem.find_by_order_id(odr_id)
|
||||||
|
if !orderItem.nil?
|
||||||
|
if order_item["id"] == orderItem.order_items_id
|
||||||
|
if orderItem.qty.to_f != order_item['qty'].to_f
|
||||||
|
new_order_status = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if new_order_status
|
||||||
|
BookingOrder.find_by_order_id(odr_id).delete
|
||||||
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => odr_id})
|
||||||
|
else
|
||||||
|
customer = Customer.find(params[:customer_id])
|
||||||
|
order_type = "dine_in"
|
||||||
|
if !customer.nil?
|
||||||
|
if customer.customer_type == "Takeaway"
|
||||||
|
order_type = "takeaway"
|
||||||
|
elsif customer.customer_type == "Delivery"
|
||||||
|
order_type = "delivery"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# begin
|
||||||
|
order = Order.new
|
||||||
|
order.source = "cashier"
|
||||||
|
order.order_type = order_type
|
||||||
|
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
|
order.item_count = order_items.count
|
||||||
|
order.status = "new"
|
||||||
|
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||||
|
order.waiters = current_user.name
|
||||||
|
order.employee_name = current_user.name
|
||||||
|
order.guest_info = nil
|
||||||
|
order.save!
|
||||||
|
|
||||||
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||||
|
|
||||||
|
order_items.each do |order_item|
|
||||||
|
update_order_item(order.order_id, order_item)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
BookingOrder.find_by_order_id(order_id).delete
|
puts "order_id_count < 1"
|
||||||
|
new_order_status = true
|
||||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_id})
|
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
orderItem = OrderItem.find(order_item["id"])
|
orderItem = OrderItem.find_by_order_id(order_id)
|
||||||
orderItem.order_id = order_id
|
if !orderItem.nil?
|
||||||
orderItem.save!
|
if order_item["id"] == orderItem.order_items_id
|
||||||
|
if orderItem.qty.to_f != order_item['qty'].to_f
|
||||||
|
new_order_status = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if new_order_status
|
||||||
|
BookingOrder.find_by_order_id(order_id).delete
|
||||||
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_id})
|
||||||
|
order_items.each do |order_item|
|
||||||
|
update_order_item(order_id, order_item)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
customer = Customer.find(params[:customer_id])
|
||||||
|
order_type = "dine_in"
|
||||||
|
if !customer.nil?
|
||||||
|
if customer.customer_type == "Takeaway"
|
||||||
|
order_type = "takeaway"
|
||||||
|
elsif customer.customer_type == "Delivery"
|
||||||
|
order_type = "delivery"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# begin
|
||||||
|
order = Order.new
|
||||||
|
order.source = "cashier"
|
||||||
|
order.order_type = order_type
|
||||||
|
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
|
order.item_count = order_items.count
|
||||||
|
order.status = "new"
|
||||||
|
order.table_id = params[:dining_id] # this is dining facilities's id
|
||||||
|
order.waiters = current_user.name
|
||||||
|
order.employee_name = current_user.name
|
||||||
|
order.guest_info = nil
|
||||||
|
order.save!
|
||||||
|
|
||||||
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||||
|
|
||||||
|
order_items.each do |order_item|
|
||||||
|
update_order_item(order.order_id, order_item)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if order_ids.count == 1 && order_id_count > 0 && order_item_count == 1
|
if order_ids.count == 1 && order_id_count > 0 && order_item_count == 1
|
||||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
|
||||||
|
order_items.each do |order_item|
|
||||||
|
update_order_item(order_ids[0], order_item)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
customer = Customer.find(params[:customer_id])
|
customer = Customer.find(params[:customer_id])
|
||||||
order_type = "dine_in"
|
order_type = "dine_in"
|
||||||
@@ -185,9 +308,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
|
||||||
|
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
orderItem = OrderItem.find(order_item["id"])
|
update_order_item(order.order_id, order_item)
|
||||||
orderItem.order_id = order.order_id
|
|
||||||
orderItem.save!
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -212,6 +333,29 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_order_item(order_id, order_item)
|
||||||
|
orderItem = OrderItem.find(order_item["id"])
|
||||||
|
if orderItem.qty.to_f != order_item['qty'].to_f
|
||||||
|
OrderItem.processs_item(orderItem.item_code,
|
||||||
|
orderItem.item_instance_code,
|
||||||
|
orderItem.item_name,
|
||||||
|
orderItem.alt_name,
|
||||||
|
orderItem.account_id,
|
||||||
|
order_item['qty'],
|
||||||
|
orderItem.price,
|
||||||
|
orderItem.options,
|
||||||
|
orderItem.set_menu_items,
|
||||||
|
order_id,
|
||||||
|
orderItem.item_order_by,
|
||||||
|
orderItem.taxable)
|
||||||
|
|
||||||
|
orderItem.qty = orderItem.qty.to_f - order_item['qty'].to_f
|
||||||
|
else
|
||||||
|
orderItem.order_id = order_id
|
||||||
|
end
|
||||||
|
orderItem.save!
|
||||||
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
helper_method :shop_detail
|
helper_method :shop_detail
|
||||||
def shop_detail
|
def shop_detail
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
class Origami::SurveysController < BaseOrigamiController
|
class Origami::SurveysController < BaseOrigamiController
|
||||||
def new
|
def new
|
||||||
|
|
||||||
@survey = Survey.new
|
@survey = Survey.new
|
||||||
@id = params[:id]
|
@id = params[:id]
|
||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
|
|
||||||
|
|
||||||
if(@id[0,3] == "SAL")
|
if(@id[0,3] == "SAL")
|
||||||
@sale = Sale.find(@id)
|
@sale = Sale.find(@id)
|
||||||
@receipt_no = @sale.receipt_no
|
@receipt_no = @sale.receipt_no
|
||||||
@grand_total = @sale.grand_total
|
@grand_total = @sale.grand_total
|
||||||
@booking = Booking.find_by_sale_id(@id)
|
@booking = Booking.find_by_sale_id(@id)
|
||||||
|
|
||||||
if @booking.dining_facility_id.to_i>0
|
if @booking.dining_facility_id.to_i>0
|
||||||
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
|
||||||
@table_type = @dining_facility.type
|
@table_type = @dining_facility.type
|
||||||
|
@survey_data = Survey.find_by_dining_name(@dining_facility.name)
|
||||||
|
survey_process = Survey.find_by_receipt_no(@receipt_no)
|
||||||
|
if !survey_process.nil?
|
||||||
|
@survey_data = survey_process
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@dining_facility = nil
|
@dining_facility = nil
|
||||||
@table_type = nil
|
@table_type = nil
|
||||||
@@ -22,6 +30,7 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
@table_type = @dining_facility.type
|
@table_type = @dining_facility.type
|
||||||
@receipt_no = nil
|
@receipt_no = nil
|
||||||
@grand_total = nil
|
@grand_total = nil
|
||||||
|
@survey_data = Survey.find_by_dining_name(@dining_facility.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -36,20 +45,71 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
||||||
end
|
end
|
||||||
@survey = Survey.new(survey_params)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
||||||
@survey.foreigner = params["survey"]["foreigner"].to_json
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
# respond_to do |format|
|
|
||||||
if @survey.save
|
if params[:survey_id].nil? || params[:survey_id] == ""
|
||||||
redirect_to @url
|
@survey = Survey.new(survey_params)
|
||||||
end
|
@survey.shift_id = shift_by_terminal.id
|
||||||
# end
|
@survey.foreigner = params["survey"]["foreigner"].to_json
|
||||||
|
# respond_to do |format|
|
||||||
|
if @survey.save
|
||||||
|
redirect_to @url
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
else
|
||||||
|
survey = Survey.find_by_id(params[:survey_id])
|
||||||
|
survey.child = params["survey"]["child"]
|
||||||
|
survey.adult = params["survey"]["adult"]
|
||||||
|
survey.male = params["survey"]["male"]
|
||||||
|
survey.female = params["survey"]["female"]
|
||||||
|
survey.local = params["survey"]["local"]
|
||||||
|
survey.dining_name = params["survey"]["dining_name"]
|
||||||
|
survey.receipt_no = params["survey"]["receipt_no"]
|
||||||
|
survey.shift_id = shift_by_terminal.id
|
||||||
|
survey.created_by = params["survey"]["created_by"]
|
||||||
|
survey.total_customer = params["survey"]["total_customer"]
|
||||||
|
survey.total_amount = params["survey"]["total_amount"]
|
||||||
|
survey.foreigner = params["survey"]["foreigner"].to_json
|
||||||
|
if survey.save!
|
||||||
|
redirect_to @url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_survey
|
||||||
|
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||||
|
dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||||
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
|
|
||||||
|
survey = Survey.find_by_dining_name(dining_facility.name)
|
||||||
|
|
||||||
|
if survey.nil?
|
||||||
|
survey = Survey.new
|
||||||
|
survey.dining_name = dining_facility.name
|
||||||
|
survey.receipt_no = params[:receipt_no]
|
||||||
|
survey.shift_id = shift_by_terminal.id
|
||||||
|
survey.created_by = current_user.name
|
||||||
|
survey.total_customer = params[:total_customer]
|
||||||
|
survey.total_amount = params[:total_amount]
|
||||||
|
survey.save!
|
||||||
|
else
|
||||||
|
survey.receipt_no = params[:receipt_no]
|
||||||
|
survey.total_customer = params[:total_customer]
|
||||||
|
survey.save!
|
||||||
|
end
|
||||||
|
render :json => {status: true}
|
||||||
|
else
|
||||||
|
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# 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 survey_params
|
def survey_params
|
||||||
params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount)
|
params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount,:survey_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
@date = @sale.created_at
|
@date = @sale.created_at
|
||||||
@status_sale = 'sale'
|
@status_sale = 'sale'
|
||||||
@customer = @sale.customer
|
@customer = @sale.customer
|
||||||
|
#for split bill
|
||||||
|
lookup_spit_bill = Lookup.collection_of('split_bill')
|
||||||
|
@split_bill = 0
|
||||||
|
if !lookup_spit_bill[0].nil?
|
||||||
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Shop Name in Navbor
|
#Shop Name in Navbor
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
|
survey = Survey.find_by_receipt_no(sale.receipt_no)
|
||||||
|
|
||||||
if sale.discount_type == "member_discount"
|
if sale.discount_type == "member_discount"
|
||||||
sale.update_attributes(total_discount: 0)
|
sale.update_attributes(total_discount: 0)
|
||||||
sale.compute_by_sale_items(sale_id, sale.sale_items,0)
|
sale.compute_by_sale_items(sale_id, sale.sale_items,0)
|
||||||
@@ -123,7 +125,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil)
|
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,survey)
|
||||||
end
|
end
|
||||||
|
|
||||||
#end print
|
#end print
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class Booking < ApplicationRecord
|
|||||||
has_many :booking_orders
|
has_many :booking_orders
|
||||||
has_many :orders, :through => :booking_orders
|
has_many :orders, :through => :booking_orders
|
||||||
scope :active, -> {where("booking_status != 'moved'")}
|
scope :active, -> {where("booking_status != 'moved'")}
|
||||||
|
scope :today, -> {where("created_at >= #{Time.now.utc}")}
|
||||||
|
|
||||||
def self.update_dining_facility(booking_arr, newd, old)
|
def self.update_dining_facility(booking_arr, newd, old)
|
||||||
table = DiningFacility.find(newd)
|
table = DiningFacility.find(newd)
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ class License
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@license = Marshal.load(cache_license)
|
# @license = Marshal.load(cache_license)
|
||||||
assign(aes_key, aes_iv)
|
# assign(aes_key, aes_iv)
|
||||||
Rails.logger.info 'API License'
|
# Rails.logger.info 'API License'
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -173,19 +173,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data)
|
def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data,survey)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,survey)
|
||||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
if !receipt_bill_a5_pdf.empty?
|
if !receipt_bill_a5_pdf.empty?
|
||||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||||
if receipt_bilA5[1] == '1'
|
if receipt_bilA5[1] == '1'
|
||||||
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data)
|
pdf = ReceiptBillA5Pdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,survey)
|
||||||
else
|
else
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data)
|
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data,survey)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class ReceiptBillA5Pdf < Prawn::Document
|
class ReceiptBillA5Pdf < Prawn::Document
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
|
||||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance)
|
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,survey)
|
||||||
self.page_width = printer_settings.page_width
|
self.page_width = printer_settings.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.margin = 15
|
self.margin = 15
|
||||||
@@ -65,6 +65,12 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
|
|
||||||
customer(customer_name)
|
customer(customer_name)
|
||||||
|
|
||||||
|
#start card sale trans data
|
||||||
|
if card_data != nil
|
||||||
|
card_sale_data(card_data)
|
||||||
|
end
|
||||||
|
#end card sale trans data
|
||||||
|
|
||||||
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
if discount_price_by_accounts.length > 0 && shop_details.show_account_info
|
||||||
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
@@ -73,6 +79,12 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#start for individual payment
|
||||||
|
if !survey.nil?
|
||||||
|
individual_payment(sale_data, survey, printer_settings.precision, delimiter)
|
||||||
|
end
|
||||||
|
#end for individual payment
|
||||||
|
|
||||||
sign(sale_data)
|
sign(sale_data)
|
||||||
|
|
||||||
footer(printed_status)
|
footer(printed_status)
|
||||||
@@ -459,6 +471,28 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#individual payment per person
|
||||||
|
def individual_payment(sale_data, survey, precision, delimiter)
|
||||||
|
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
|
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
|
move_down 15
|
||||||
|
text "Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 15
|
||||||
|
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def sign(sale_data)
|
def sign(sale_data)
|
||||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||||
if payment.payment_method == "creditnote"
|
if payment.payment_method == "creditnote"
|
||||||
@@ -513,6 +547,29 @@ class ReceiptBillA5Pdf < Prawn::Document
|
|||||||
move_down 10
|
move_down 10
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#start card sale trans data
|
||||||
|
def card_sale_data(card_data)
|
||||||
|
if card_data != nil && !card_data.empty?
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
card_data.each do |data|
|
||||||
|
if data['app'] == 'CUP'
|
||||||
|
data['app'] = 'UNIONPAY'
|
||||||
|
elsif data['app'] == 'MASTERCARD'
|
||||||
|
data['app'] = 'MASTER'
|
||||||
|
end
|
||||||
|
text "DATE/TIME: #{data['res_date']} #{data['res_time']} ", :size => @item_font_size, :align => :left
|
||||||
|
text "BATCH NUM: #{data['batch_no']} TRACE#: #{data['trace']}",:size => @item_font_size, :align => :left
|
||||||
|
text "RREF NUM: #{data['ref_no']} APPR CODE: #{data['app_code']} ",:size => @item_font_size, :align => :left
|
||||||
|
text "TID: #{data['tid']} ",:size => @item_font_size, :align => :left
|
||||||
|
text "#{data['app']} #{data['pan']} ",:size => @item_font_size, :align => :left
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#check ReceiptBillAltName included
|
#check ReceiptBillAltName included
|
||||||
def show_alt_name
|
def show_alt_name
|
||||||
bill_alt_name = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
bill_alt_name = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width
|
||||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data)
|
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data,survey)
|
||||||
self.page_width = printer_settings.page_width
|
self.page_width = printer_settings.page_width
|
||||||
self.page_height = printer_settings.page_height
|
self.page_height = printer_settings.page_height
|
||||||
self.margin = 0
|
self.margin = 0
|
||||||
@@ -79,6 +79,12 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#start for individual payment
|
||||||
|
if !survey.nil?
|
||||||
|
individual_payment(sale_data, survey, printer_settings.precision, delimiter)
|
||||||
|
end
|
||||||
|
#end for individual payment
|
||||||
|
|
||||||
sign(sale_data)
|
sign(sale_data)
|
||||||
|
|
||||||
footer(printed_status)
|
footer(printed_status)
|
||||||
@@ -474,6 +480,28 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#individual payment per person
|
||||||
|
def individual_payment(sale_data, survey, precision, delimiter)
|
||||||
|
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width+50) do
|
||||||
|
text "Individual amount for #{survey.total_customer} persons", :size => self.item_font_size+1,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width) do
|
||||||
|
move_down 15
|
||||||
|
text "Total", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||||
|
move_down 15
|
||||||
|
text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def sign(sale_data)
|
def sign(sale_data)
|
||||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||||
if payment.payment_method == "creditnote"
|
if payment.payment_method == "creditnote"
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ $('#back').on('click',function(){
|
|||||||
|
|
||||||
function warnBeforeRedirect(linkURL) {
|
function warnBeforeRedirect(linkURL) {
|
||||||
swal({
|
swal({
|
||||||
title: "Oops",
|
title: "Alert!",
|
||||||
text: "Are you sure you want to Logout ?",
|
text: "Are you sure you want to close cashier?",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
}, function() {
|
}, function() {
|
||||||
|
|||||||
@@ -386,10 +386,8 @@
|
|||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
</table>
|
</table>
|
||||||
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice</button>
|
|
||||||
<% if !@spit_bill.nil? && @spit_bill == '1' %>
|
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button>
|
||||||
<button class='btn btn-primary' id='split_bill'> Split Bill</button>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @sale_array.size > 1 %>
|
<% if @sale_array.size > 1 %>
|
||||||
<br><br>
|
<br><br>
|
||||||
@@ -439,6 +437,11 @@
|
|||||||
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
|
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='move'>Move</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='move'>Move</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect" disabled>First Bill</button> -->
|
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect" disabled>First Bill</button> -->
|
||||||
<!-- <button type="button" id="pay" class="btn btn-block bg-blue waves-effect" disabled>Pay</button> -->
|
<!-- <button type="button" id="pay" class="btn btn-block bg-blue waves-effect" disabled>Pay</button> -->
|
||||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
||||||
@@ -461,6 +464,11 @@
|
|||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -571,7 +579,7 @@
|
|||||||
$("#survey").on('click', function () {
|
$("#survey").on('click', function () {
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
if (sale) {
|
if (sale) {
|
||||||
var sale_id = sale
|
var sale_id = sale;
|
||||||
} else {
|
} else {
|
||||||
var sale_id = "<%= @dining.id %>";
|
var sale_id = "<%= @dining.id %>";
|
||||||
}
|
}
|
||||||
@@ -712,30 +720,6 @@
|
|||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function () {
|
$('#request_bills').click(function () {
|
||||||
var lookup_split_bill = '<%= @spit_bill %>';
|
|
||||||
if(lookup_split_bill == '1'){
|
|
||||||
swal({
|
|
||||||
title: "Information!",
|
|
||||||
text: "Do you want to Split bill?",
|
|
||||||
type: "success",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#009900",
|
|
||||||
confirmButtonText: "Yes, split it!",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
if (isConfirm) {
|
|
||||||
var dining_id = "<%= @dining.id %>";
|
|
||||||
window.location.href = '/origami/table/' + dining_id + "/split_bills";
|
|
||||||
}else{
|
|
||||||
requestBillProcess();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
requestBillProcess();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function requestBillProcess(){
|
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -750,8 +734,14 @@
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
//split bill process
|
||||||
|
$('#split_bills').click(function(){
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
window.location.href = '/origami/table/' + dining_id + "/split_bills";
|
||||||
|
});
|
||||||
|
|
||||||
$('#move').on('click', function () {
|
$('#move').on('click', function () {
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
|||||||
@@ -200,7 +200,14 @@
|
|||||||
%>
|
%>
|
||||||
<% unless sale_item.price <= 0 %>
|
<% unless sale_item.price <= 0 %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= sale_item.item_name %></td>
|
<td class='item-name'>
|
||||||
|
<%= sale_item.item_name %>
|
||||||
|
<% if !sale_item.set_menu_items.nil?
|
||||||
|
sale_item.set_menu_items.each do |item_instance| %>
|
||||||
|
<br><span class="font-13"><%= item_instance %></span>
|
||||||
|
<% end
|
||||||
|
end %>
|
||||||
|
</td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -233,7 +240,10 @@
|
|||||||
|
|
||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
|
<button type="button" class="btn bg-default btn-block waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
<% if !@split_bill.nil? && @split_bill == '1' %>
|
||||||
|
<button type="button" class="btn bg-blue btn-block waves-effect" id='by_order'>By Order</button>
|
||||||
|
<% end %>
|
||||||
<% if @sale_status != 'completed' %>
|
<% if @sale_status != 'completed' %>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -278,5 +288,59 @@
|
|||||||
})
|
})
|
||||||
$('#move').on('click',function(){
|
$('#move').on('click',function(){
|
||||||
|
|
||||||
})
|
});
|
||||||
|
|
||||||
|
//order_split
|
||||||
|
$('#by_order').on('click',function () {
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure, you want to Split?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, split it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if(isConfirm){
|
||||||
|
orderSplitBillProcess();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* function for order items split bill process */
|
||||||
|
function orderSplitBillProcess(){
|
||||||
|
var booking = JSON.parse('<%= @booking.to_json.html_safe %>');
|
||||||
|
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
||||||
|
var order = JSON.parse('<%= @order.to_json.html_safe %>');
|
||||||
|
var arr_order = [];
|
||||||
|
arr_order.push({id : order.order_id});
|
||||||
|
|
||||||
|
var dining_id = booking[0].dining_facility_id || 0;
|
||||||
|
var type = booking[0].type || '';
|
||||||
|
var customer_id = order.customer_id || '';
|
||||||
|
var booking_id = "";
|
||||||
|
if(orders.length == 1){
|
||||||
|
booking_id = booking[0].booking_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ajax_url = "/origami/split_bills";
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
dataType: 'JSON',
|
||||||
|
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(arr_order)},
|
||||||
|
success: function (result) {
|
||||||
|
if (!result.status) {
|
||||||
|
swal("Information!", result.error_message);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(type=='Table'){
|
||||||
|
window.location.href = '/origami/table/' + dining_id;
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/room/' + dining_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -364,10 +364,7 @@
|
|||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
</table>
|
</table>
|
||||||
<button class='btn bg-primary' id='add_invoice'> Add to existing invoice </button>
|
<button class='btn bg-primary btn-block' id='add_invoice'> Add to existing invoice </button>
|
||||||
<% if !@spit_bill.nil? && @spit_bill == '1' %>
|
|
||||||
<button class='btn btn-primary' id='split_bill'> Split Bill</button>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @sale_array.size > 1 %>
|
<% if @sale_array.size > 1 %>
|
||||||
<br><br>
|
<br><br>
|
||||||
@@ -411,6 +408,11 @@
|
|||||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||||
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
||||||
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
||||||
@@ -435,6 +437,11 @@
|
|||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
<% if !@split_bill.nil? %>
|
||||||
|
<% if @split_bill == '1' %>
|
||||||
|
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -714,30 +721,6 @@ $('#pay').on('click',function() {
|
|||||||
});
|
});
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function() {
|
$('#request_bills').click(function() {
|
||||||
var lookup_split_bill = '<%= @spit_bill %>';
|
|
||||||
if(lookup_split_bill == '1'){
|
|
||||||
swal({
|
|
||||||
title: "Information!",
|
|
||||||
text: "Do you want to Split bill?",
|
|
||||||
type: "success",
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonColor: "#009900",
|
|
||||||
confirmButtonText: "Yes, split it!",
|
|
||||||
closeOnConfirm: false
|
|
||||||
}, function (isConfirm) {
|
|
||||||
if (isConfirm) {
|
|
||||||
var dining_id = "<%= @room.id %>";
|
|
||||||
window.location.href = '/origami/room/' + dining_id + "/split_bills";
|
|
||||||
}else{
|
|
||||||
requestBillProcess();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
requestBillProcess();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function requestBillProcess(){
|
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -753,7 +736,13 @@ function requestBillProcess(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
//split bill process
|
||||||
|
$('#split_bills').click(function(){
|
||||||
|
var dining_id = "<%= @room.id %>";
|
||||||
|
window.location.href = '/origami/room/' + dining_id + "/split_bills";
|
||||||
|
});
|
||||||
|
|
||||||
$('#move').on('click',function(){
|
$('#move').on('click',function(){
|
||||||
var dining_id = "<%= @room.id %>"
|
var dining_id = "<%= @room.id %>"
|
||||||
|
|||||||
@@ -20,31 +20,93 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="split-order-slimscroll" data-height="70">
|
<div id="split-order-slimscroll" data-height="70">
|
||||||
<div class="card-text dining">
|
<div class="card-text dining">
|
||||||
<% if !@orders.nil? %>
|
<% if !@orders.empty? %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
<div class="row m-l-5">
|
<div class="row m-l-5">
|
||||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||||
<ul class="nav nav-tabs tabs-left sideways">
|
<ul class="nav nav-tabs tabs-left sideways">
|
||||||
|
<li class="order-row active">
|
||||||
|
<a href="#all_order" data-toggle="tab"><strong>All</strong></a>
|
||||||
|
</li>
|
||||||
<% @orders.each.with_index(0) do |order, order_index| %>
|
<% @orders.each.with_index(0) do |order, order_index| %>
|
||||||
<% active_class = "" %>
|
<li class="order-row">
|
||||||
<% if order_index == 0 %>
|
<a href="#<%= order.order_id %>" data-toggle="tab"><strong><%= order.order_id %></strong></a>
|
||||||
<% active_class = "active" %>
|
|
||||||
<% end %>
|
|
||||||
<li class="order-row <%= active_class %>">
|
|
||||||
<a href="#<%= order.order_id %>" data-toggle="tab"><%= order.order_id %></a>
|
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane active" id="all_order">
|
||||||
|
<div class="card-title">
|
||||||
|
<p class="m-l-2">Order Items</p>
|
||||||
|
</div>
|
||||||
|
<div id="order-detail-slimscroll-all_order" data-height="200">
|
||||||
|
<div class="card-text dining">
|
||||||
|
<table class="table table-default" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</th>
|
||||||
|
<th class="item-attr">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if !@order_items.nil? %>
|
||||||
|
<% sub_total = 0 %>
|
||||||
|
<% @order_items.each do |order_item| %>
|
||||||
|
<% if order_item.include? ('all_order') %>
|
||||||
|
<% order_item['all_order'].each do |odr_item| %>
|
||||||
|
<%
|
||||||
|
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
|
||||||
|
%>
|
||||||
|
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
|
||||||
|
<td style="width:60%; text-align:left">
|
||||||
|
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
|
||||||
|
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
|
||||||
|
<span id="item-name-price">
|
||||||
|
<%=odr_item['item_name'] %>
|
||||||
|
<% if !odr_item['set_menu_items'].nil?
|
||||||
|
odr_item['set_menu_items'].each do |item_instance| %>
|
||||||
|
<br><span class="font-13"><%= item_instance %></span>
|
||||||
|
<% end
|
||||||
|
end %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-qty"><%=odr_item['qty']%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-total-price"><%=(odr_item['qty'].to_f * odr_item['price'].to_f)%></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="card-footer"> -->
|
||||||
|
<table class="table m-b-20" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr align-right"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<% @orders.each.with_index(0) do |order, order_index| %>
|
<% @orders.each.with_index(0) do |order, order_index| %>
|
||||||
<% active_class = "" %>
|
<% active_class = "" %>
|
||||||
<% if order_index == 0 %>
|
<% if order_index == 0 %>
|
||||||
<% active_class = "active" %>
|
<% active_class = "active" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="tab-pane <%= active_class %>" id="<%= order.order_id %>">
|
<div class="tab-pane" id="<%= order.order_id %>">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
<p class="m-l-2">Order Items</p>
|
<p class="m-l-2">Order Items</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -59,32 +121,34 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% if !order.order_items.nil? %>
|
<% if !@order_items.nil? %>
|
||||||
<% sub_total = 0 %>
|
<% sub_total = 0 %>
|
||||||
<% order.order_items.each do |order_item| %>
|
<% @order_items.each do |order_item| %>
|
||||||
|
<% if order_item.include? (order.order_id.to_s) %>
|
||||||
<%
|
<%
|
||||||
sub_total += order_item.qty*order_item.price
|
sub_total += order_item[order.order_id.to_s]['qty'].to_f * order_item[order.order_id.to_s]['price'].to_f
|
||||||
%>
|
%>
|
||||||
<tr class="item-row" id=<%= order_item.order_items_id %> >
|
<tr class="item-row" id=<%= order_item[order.order_id.to_s]['order_items_id'] %> >
|
||||||
<td style="width:60%; text-align:left">
|
<td style="width:60%; text-align:left">
|
||||||
<span id="item-order-id" class="hidden"><%=order_item.order_id%></span>
|
<span id="item-order-id" class="hidden"><%=order_item[order.order_id.to_s]['order_id'] %></span>
|
||||||
<span id="item-account-type" class="hidden"><%=order_item.account_id%></span>
|
<span id="item-account-type" class="hidden"><%=order_item[order.order_id.to_s]['account_id'] %></span>
|
||||||
<span id="item-name-price">
|
<span id="item-name-price">
|
||||||
<%=order_item.item_name%>
|
<%=order_item[order.order_id.to_s]['item_name'] %>
|
||||||
<% if !order_item.set_menu_items.nil?
|
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
||||||
order_item.set_menu_items.each do |item_instance| %>
|
order_item[order.order_id.to_s]['set_menu_items'].each do |item_instance| %>
|
||||||
<br><span class="font-13"><%= item_instance %></span>
|
<br><span class="font-13"><%= item_instance %></span>
|
||||||
<% end
|
<% end
|
||||||
end %>
|
end %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
<span id="item-qty"><%=order_item.qty%></span>
|
<span id="item-qty"><%=order_item[order.order_id.to_s]['qty']%></span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%; text-align:right">
|
<td style="width:20%; text-align:right">
|
||||||
<span id="item-total-price"><%=(order_item.qty*order_item.price)%></span>
|
<span id="item-total-price"><%=(order_item[order.order_id.to_s]['qty'].to_f * order_item[order.order_id.to_s]['price'].to_f)%></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% end %>
|
||||||
<%
|
<%
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
@@ -124,13 +188,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="split-receipt-slimscroll" data-height="150">
|
<div id="split-receipt-slimscroll" data-height="150">
|
||||||
<div class="card-text dining">
|
<div class="card-text dining">
|
||||||
<% if !@sale_data.nil? %>
|
<% if !@sale_data.empty? %>
|
||||||
<table class="table table-default">
|
<table class="table table-default">
|
||||||
|
<thead>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Receipt No.</th>
|
||||||
|
<th>Total</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @sale_data.each do |sale_data| %>
|
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
||||||
<% if sale_data.sale_status != 'completed' %>
|
<% if sale_data.sale_status != 'completed' && sale_data.sale_status != 'void' %>
|
||||||
<tr class="receipt_row" id=<%= sale_data.sale_id %> >
|
<% checked = "" %>
|
||||||
<td>Receipt No. - <span id="receipt_no"><%= sale_data.receipt_no %></span></td>
|
<% if sale_index == 1 %>
|
||||||
|
<% checked = "checked" %>
|
||||||
|
<% end %>
|
||||||
|
<tr class="receipt-row" id=<%= sale_data.receipt_no %> data=<%= sale_data.grand_total %> >
|
||||||
|
<td><input type="radio" name="rdn_receipt" id="rdn_receipt" value="<%= sale_data.sale_id %>" <%= checked %>></td>
|
||||||
|
<td><span id="receipt_no"><%= sale_data.receipt_no %></span></td>
|
||||||
|
<td><span id="grand_total"><%= sale_data.grand_total %></span></td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -148,16 +227,96 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Action Panel -->
|
<!-- Action Panel -->
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn bg-default btn-block" id="back" ><i class="material-icons">reply</i> Back </button>
|
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||||
<button id="order_split" class="btn btn-primary text-center action-btn" style="width:100%">Orders Split</button>
|
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
||||||
<button id="order_item_split" class="btn btn-primary text-center action-btn">Order Items Split</button>
|
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>
|
||||||
|
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- modal for equal person -->
|
||||||
|
<div class="modal fade" id="equal_split_modal" tabindex="-1" role="dialog" aria-labelledby="equal_split_modal_label" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="equal_split_modal_label">Equal Split (per person)</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" id="per_person" name="per_person" class="form-control" onkeypress="return isNumberKey(event);"/><br>
|
||||||
|
<span id="per_personErr" style="color:red;"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<div class="p-l-50">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="1" data-type="num" style="margin-left: 6px;">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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom clearfix">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="4" data-type="num" style="margin-left: 6px;">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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" data-value="7" data-type="num" style="margin-left: 6px;">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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 cashier_number" style="margin-left: 6px;"></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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn bg-default" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn bg-blue btn_per_person">= Split</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- modal for equal person -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var split_sale_id = "";
|
||||||
|
var split_receipt_no = "";
|
||||||
|
var split_total_amount = 0;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
@@ -171,28 +330,28 @@
|
|||||||
var input_type = $(this).attr("data-type");
|
var input_type = $(this).attr("data-type");
|
||||||
switch (input_type) {
|
switch (input_type) {
|
||||||
case 'num':
|
case 'num':
|
||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
if (original_value == "0"){
|
if (original_value == "0"){
|
||||||
$('#per_person').val(input_value);
|
$('#per_person').val(input_value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#per_person').val(original_value + '' + input_value);
|
$('#per_person').val(original_value + '' + input_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'add':
|
case 'add':
|
||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
amount = parseInt(input_value);
|
amount = parseInt(input_value);
|
||||||
$('#per_person').val(amount);
|
$('#per_person').val(amount);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'del' :
|
case 'del' :
|
||||||
var discount_text=$('#per_person').val();
|
var discount_text=$('#per_person').val();
|
||||||
$('#per_person').val(discount_text.substr(0,discount_text.length-1));
|
$('#per_person').val(discount_text.substr(0,discount_text.length-1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'clr':
|
case 'clr':
|
||||||
$('#per_person').val("0");
|
$('#per_person').val("");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.handled = true;
|
event.handled = true;
|
||||||
@@ -242,6 +401,21 @@
|
|||||||
|
|
||||||
// Selected Order
|
// Selected Order
|
||||||
$('.order-row').on('click',function(){
|
$('.order-row').on('click',function(){
|
||||||
|
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
||||||
|
var check_order_id = $(this).find('a').attr('href').substr(1);
|
||||||
|
|
||||||
|
if(check_order_id == 'all_order'){
|
||||||
|
if(orders.length > 0){
|
||||||
|
$.each(orders, function(key,value){
|
||||||
|
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
|
||||||
|
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("a[href$='#all_order']").parent().removeClass('selected-split-item');
|
||||||
|
}
|
||||||
|
|
||||||
if($(this).hasClass('selected-split-item') == true){
|
if($(this).hasClass('selected-split-item') == true){
|
||||||
$(this).removeClass('selected-split-item');
|
$(this).removeClass('selected-split-item');
|
||||||
}
|
}
|
||||||
@@ -254,7 +428,17 @@
|
|||||||
$('#order_split').on('click',function () {
|
$('#order_split').on('click',function () {
|
||||||
var cnt_orders = "<%= @orders.count %>";
|
var cnt_orders = "<%= @orders.count %>";
|
||||||
var orders = get_selected_orders();// Selected Order Items
|
var orders = get_selected_orders();// Selected Order Items
|
||||||
var cnt_odrs = parseInt(cnt_orders) - parseInt(orders.length);
|
var cnt_odrs = 0;
|
||||||
|
if(orders.length == 1){
|
||||||
|
if(orders[0].id == 'all_order'){
|
||||||
|
cnt_odrs = 0;
|
||||||
|
}else{
|
||||||
|
cnt_odrs = parseInt(cnt_orders) - parseInt(orders.length);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cnt_odrs = parseInt(cnt_orders) - parseInt(orders.length);
|
||||||
|
}
|
||||||
|
|
||||||
if (orders.length > 0){
|
if (orders.length > 0){
|
||||||
// if(cnt_odrs > 0){
|
// if(cnt_odrs > 0){
|
||||||
swal({
|
swal({
|
||||||
@@ -280,12 +464,92 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//selected receipt row click
|
//selected receipt row click
|
||||||
$('.receipt_row').on('click',function(){
|
$('.btn_pay').on('click',function(){
|
||||||
var dining_id = $("#table_id").text();
|
var dining_id = $("#table_id").text();
|
||||||
var sale_id = $(this).attr('id').substr(0,16);
|
var sale_id = $(this).attr('id').substr(0,16);
|
||||||
window.location = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
|
window.location = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//equal split process
|
||||||
|
$('#equal_split').on('click', function(){
|
||||||
|
split_sale_id = $("input[type='radio'][name='rdn_receipt']:checked").val();
|
||||||
|
split_receipt_no = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('id');
|
||||||
|
split_total_amount = $("input[type='radio'][name='rdn_receipt']:checked").parent().parent().attr('data');
|
||||||
|
if(split_sale_id != undefined && split_sale_id != ""){
|
||||||
|
$('#equal_split_modal').modal({backdrop: 'static', keyboard: true, show: true});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
swal("Opps","Please select one receipt!","warning");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn_per_person').on('click', function(){
|
||||||
|
var person = $('#per_person').val();
|
||||||
|
|
||||||
|
if((person!=undefined) && (person!="")){
|
||||||
|
$("#per_personErr").html('');
|
||||||
|
$('#equal_split_modal').modal('hide');
|
||||||
|
if(person > 1){
|
||||||
|
var ajax_url = "/origami/split_bills/surveys";
|
||||||
|
var dining_id = $("#table_id").text();
|
||||||
|
var type = $("#table_type").text();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
dataType: 'JSON',
|
||||||
|
data: {'dining_id':dining_id, 'sale_id':split_sale_id, 'receipt_no':split_receipt_no, 'total_customer': person, 'total_amount':split_total_amount },
|
||||||
|
success: function (result) {
|
||||||
|
console.log(result);
|
||||||
|
if(result.status){
|
||||||
|
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success: function (result) {
|
||||||
|
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||||
|
|
||||||
|
// location.reload();
|
||||||
|
// if(type=='Table'){
|
||||||
|
// window.location.href = '/origami/table/' + dining_id;
|
||||||
|
// }else{
|
||||||
|
// window.location.href = '/origami/room/' + dining_id;
|
||||||
|
// }
|
||||||
|
|
||||||
|
window.location.href = '/origami/sale/' + split_sale_id + "/payment";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success: function (result) {
|
||||||
|
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||||
|
|
||||||
|
// location.reload();
|
||||||
|
// if(type=='Table'){
|
||||||
|
// window.location.href = '/origami/table/' + dining_id;
|
||||||
|
// }else{
|
||||||
|
// window.location.href = '/origami/room/' + dining_id;
|
||||||
|
// }
|
||||||
|
window.location.href = '/origami/sale/' + split_sale_id + "/payment";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$("#per_personErr").html("can't be blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//equal split process
|
||||||
|
|
||||||
//slimscroll for order, order items, reciept
|
//slimscroll for order, order items, reciept
|
||||||
var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
|
var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
|
||||||
|
|
||||||
@@ -307,6 +571,15 @@
|
|||||||
railBorderRadius: '0'
|
railBorderRadius: '0'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#order-detail-slimscroll-all_order').slimScroll({
|
||||||
|
height: height-$('#split-receipt-slimscroll').attr('data-height'),
|
||||||
|
size: '5px',
|
||||||
|
color: 'rgba(0,0,0,0.5)',
|
||||||
|
alwaysVisible: false,
|
||||||
|
borderRadius: '0',
|
||||||
|
railBorderRadius: '0'
|
||||||
|
});
|
||||||
|
|
||||||
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
||||||
if(orders.length > 0){
|
if(orders.length > 0){
|
||||||
$.each(orders, function(key,order){
|
$.each(orders, function(key,order){
|
||||||
@@ -417,6 +690,7 @@ function get_selected_order_items(){
|
|||||||
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
||||||
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||||
order_item.account_id = $(this).find('#item-account-type').text();
|
order_item.account_id = $(this).find('#item-account-type').text();
|
||||||
|
order_item.qty = $(this).find('#item-qty').text();
|
||||||
order_item.price = $(this).find('#item-total-price').text();
|
order_item.price = $(this).find('#item-total-price').text();
|
||||||
order_items.push(order_item);
|
order_items.push(order_item);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,42 +5,74 @@
|
|||||||
<%= simple_form_for(@survey, :url => origami_create_surveys_path) do |f| %>
|
<%= simple_form_for(@survey, :url => origami_create_surveys_path) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
<div class="form-inputs p-l-10">
|
<div class="form-inputs p-l-10">
|
||||||
|
<% if !@survey_data.nil? %>
|
||||||
|
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10' }%>
|
||||||
|
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10' }%>
|
||||||
|
<%= f.input :male , input_html: { value: @survey_data.male, class: 'col-md-10' }%>
|
||||||
|
<%= f.input :female , input_html: { value: @survey_data.female, class: 'col-md-10' }%>
|
||||||
|
<%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-10'} %>
|
||||||
|
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-10' }%>
|
||||||
|
|
||||||
<%= f.input :child , input_html: { class: 'col-md-10' }%>
|
<div class="row clearfix">
|
||||||
<%= f.input :adult , input_html: { class: 'col-md-10' }%>
|
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||||
<%= f.input :male , input_html: { class: 'col-md-10' }%>
|
<div class="form-group p-l-10 p-r-10">
|
||||||
<%= f.input :female , input_html: { class: 'col-md-10' }%>
|
<label class="p-l-10">Foreigner</label>
|
||||||
<%= f.input :total_customer, input_html: { class: 'col-md-10'} %>
|
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||||
<%= f.input :local , input_html: { class: 'col-md-10' }%>
|
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||||
|
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||||
<div class="row clearfix">
|
<option value="<%= ct.value %>">
|
||||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
<%= ct.name %></option>
|
||||||
<div class="form-group p-l-10 p-r-10">
|
<%end %>
|
||||||
<label class="p-l-10">Foreigner</label>
|
</select>
|
||||||
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
</div>
|
||||||
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
|
||||||
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
|
||||||
<option value="<%= ct.value %>">
|
|
||||||
<%= ct.name %></option>
|
|
||||||
<%end %>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
<div class="form-group p-l-10 p-r-10">
|
||||||
<div class="form-group p-l-10 p-r-10">
|
<label class="p-l-10">Number</label>
|
||||||
<label class="p-l-10">Number</label>
|
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||||
<input type="number" name="survey[foreigner][]" class="form-control">
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
<br>
|
||||||
<br>
|
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||||
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% else %>
|
||||||
|
<%= f.input :child , input_html: { class: 'col-md-10' }%>
|
||||||
|
<%= f.input :adult , input_html: { class: 'col-md-10' }%>
|
||||||
|
<%= f.input :male , input_html: { class: 'col-md-10' }%>
|
||||||
|
<%= f.input :female , input_html: { class: 'col-md-10' }%>
|
||||||
|
<%= f.input :total_customer, input_html: { class: 'col-md-10'} %>
|
||||||
|
<%= f.input :local , input_html: { class: 'col-md-10' }%>
|
||||||
|
|
||||||
|
<div class="row clearfix">
|
||||||
|
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||||
|
<div class="form-group p-l-10 p-r-10">
|
||||||
|
<label class="p-l-10">Foreigner</label>
|
||||||
|
<!-- <input type="text" class="form-control" name="survey[foreigner][]"> -->
|
||||||
|
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][]" style="height: " >
|
||||||
|
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
|
||||||
|
<option value="<%= ct.value %>">
|
||||||
|
<%= ct.name %></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
|
||||||
|
<div class="form-group p-l-10 p-r-10">
|
||||||
|
<label class="p-l-10">Number</label>
|
||||||
|
<input type="number" name="survey[foreigner][]" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
|
||||||
|
<br>
|
||||||
|
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="hidden" id="newTemplate" >
|
<div class="hidden" id="newTemplate" >
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%if !@dining_facility.nil?%>
|
<%if !@dining_facility.nil?%>
|
||||||
<input type="hidden" name="table_id" value="<%= @dining_facility.id %>">
|
<input type="hidden" name="table_id" value="<%= @dining_facility.id %>">
|
||||||
<input type="hidden" name="table_type" value="<%= @table_type %>">
|
<input type="hidden" name="table_type" value="<%= @table_type %>">
|
||||||
@@ -52,7 +84,15 @@
|
|||||||
<%end%>
|
<%end%>
|
||||||
<input type="hidden" name="sale_id" value="<%=@id%>">
|
<input type="hidden" name="sale_id" value="<%=@id%>">
|
||||||
<input type="hidden" name="cashier_type" value="<%=@cashier_type%>">
|
<input type="hidden" name="cashier_type" value="<%=@cashier_type%>">
|
||||||
|
|
||||||
|
<% if !@survey_data.nil? %>
|
||||||
|
<input type="hidden" name="survey_id" value=<%= @survey_data.id %> />
|
||||||
|
<% else %>
|
||||||
|
<input type="hidden" name="survey_id" />
|
||||||
|
<% end %>
|
||||||
|
<input type="hidden" name="table_id" value="<%=@dining_facility.id%>">
|
||||||
|
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
|
||||||
|
|
||||||
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
||||||
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
||||||
<%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
|
<%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %>
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn bg-danger btn-block"> Void </button>
|
<button type="button" id="void" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true" > Void </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -173,22 +173,40 @@ $('#pay').on('click',function() {
|
|||||||
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
|
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
|
||||||
});
|
});
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
window.location.href = '/origami/table/<%= @table.id %>';
|
var lookup_split_bill = '<%= @split_bill %>';
|
||||||
|
if(lookup_split_bill == '1'){
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>/split_bills';
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/table/<%= @table.id %>';
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#void').on('click',function () {
|
|
||||||
var sure = confirm("Are you sure want to Void");
|
|
||||||
if (sure == true) {
|
|
||||||
var sale_id = $('#sale_id').val();
|
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ajax_url,
|
|
||||||
success: function () {
|
|
||||||
window.location.href = '/origami/';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
$('#void').on('click',function () {
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to Void?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
swal("Opps","You are not authorized for void","warning")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post '/:sale_id/get_customer' => "customers#get_customer"
|
post '/:sale_id/get_customer' => "customers#get_customer"
|
||||||
|
|
||||||
get '/:id/:type/surveys', to: "surveys#new"
|
get '/:id/:type/surveys', to: "surveys#new"
|
||||||
post '/:id/create_survey' => "surveys#create", :as => "create_surveys"
|
match '/:id/create_survey', to: "surveys#create", as: "create_surveys", via: [:post, :patch, :put]
|
||||||
|
|
||||||
get '/addorders/get_menu/:id' => "addorders#get_menu",:as => "get_menu", :defaults => { :format => 'json' }
|
get '/addorders/get_menu/:id' => "addorders#get_menu",:as => "get_menu", :defaults => { :format => 'json' }
|
||||||
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
get '/addorders/get_menu_category/:id' => "addorders#get_menu_category",:as => "get_menu_category", :defaults => { :format => 'json' }
|
||||||
@@ -238,6 +238,8 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
get '/room/:dining_id/split_bills' => 'split_bill#index'
|
get '/room/:dining_id/split_bills' => 'split_bill#index'
|
||||||
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills"
|
||||||
|
|
||||||
|
post '/split_bills/surveys', to: 'surveys#create_survey'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Waiter/Ordering Station ------------#
|
#--------- Waiter/Ordering Station ------------#
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace :clear do
|
|||||||
SalePayment.delete_all
|
SalePayment.delete_all
|
||||||
ShiftSale.delete_all
|
ShiftSale.delete_all
|
||||||
PaymentJournal.delete_all
|
PaymentJournal.delete_all
|
||||||
|
Survey.delete_all
|
||||||
DiningFacility.update_all(status:'available')
|
DiningFacility.update_all(status:'available')
|
||||||
CashierTerminal.update_all(is_currently_login: 0)
|
CashierTerminal.update_all(is_currently_login: 0)
|
||||||
puts "Clear Data Done."
|
puts "Clear Data Done."
|
||||||
|
|||||||
Reference in New Issue
Block a user