Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -46,8 +46,11 @@ gem 'mini_magick'
|
||||
gem 'cups'
|
||||
gem 'prawn'
|
||||
gem 'prawn-table'
|
||||
gem 'spreadsheet'
|
||||
gem 'to_xls-rails'
|
||||
gem 'rubyzip', '= 1.0.0'
|
||||
gem 'axlsx', '= 2.0.1'
|
||||
gem 'axlsx_rails'
|
||||
gem 'roo'
|
||||
#Reporting gem
|
||||
#gem 'compendium'
|
||||
#gem "cancan"
|
||||
|
||||
18
Gemfile.lock
18
Gemfile.lock
@@ -50,6 +50,13 @@ GEM
|
||||
airbrussh (1.3.0)
|
||||
sshkit (>= 1.6.1, != 1.7.0)
|
||||
arel (8.0.0)
|
||||
axlsx (2.0.1)
|
||||
htmlentities (~> 4.3.1)
|
||||
nokogiri (>= 1.4.1)
|
||||
rubyzip (~> 1.0.0)
|
||||
axlsx_rails (0.5.1)
|
||||
actionpack (>= 3.1)
|
||||
axlsx (>= 2.0.1)
|
||||
bcrypt (3.1.11)
|
||||
bindex (0.5.0)
|
||||
builder (3.2.3)
|
||||
@@ -100,6 +107,7 @@ GEM
|
||||
railties (>= 3.2, < 5.2)
|
||||
globalid (0.4.1)
|
||||
activesupport (>= 4.2.0)
|
||||
htmlentities (4.3.4)
|
||||
httparty (0.15.6)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.9.1)
|
||||
@@ -197,6 +205,10 @@ GEM
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
redis (3.3.5)
|
||||
roo (1.13.2)
|
||||
nokogiri
|
||||
rubyzip
|
||||
spreadsheet (> 0.6.4)
|
||||
rspec-core (3.7.0)
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-expectations (3.7.0)
|
||||
@@ -215,6 +227,7 @@ GEM
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-support (3.7.0)
|
||||
ruby-ole (1.2.12.1)
|
||||
rubyzip (1.0.0)
|
||||
sass (3.5.3)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
@@ -286,6 +299,8 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
aescrypt
|
||||
axlsx (= 2.0.1)
|
||||
axlsx_rails
|
||||
bcrypt (~> 3.1.7)
|
||||
byebug
|
||||
cancancan (~> 1.10)
|
||||
@@ -320,13 +335,14 @@ DEPENDENCIES
|
||||
rack-cors
|
||||
rails (~> 5.1.0)
|
||||
redis (~> 3.0)
|
||||
roo
|
||||
rspec-rails (~> 3.5)
|
||||
rubyzip (= 1.0.0)
|
||||
sass-rails (~> 5.0)
|
||||
schema_to_scaffold
|
||||
shoulda-matchers (~> 3.1)
|
||||
sidekiq
|
||||
simple_form
|
||||
spreadsheet
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
tether-rails
|
||||
|
||||
@@ -196,7 +196,7 @@ $(function() {
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+" p-t-65 m-r--5' data-item-code='"
|
||||
+"<div class='"+add_icon+" p-t-65 m-r-' data-item-code='"
|
||||
+ menu_items[field].code +"' data-name='"
|
||||
+ menu_items[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
|
||||
@@ -249,7 +249,7 @@ function setCommPorts(comPortLists) {
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -342,6 +342,8 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun
|
||||
}else{
|
||||
if(payment_type!="master"){
|
||||
payment_type = payment_type.toUpperCase();
|
||||
}else{
|
||||
payment_type = "Master";
|
||||
}
|
||||
swal({
|
||||
title: 'Oops',
|
||||
|
||||
@@ -6,7 +6,7 @@ class Oqs::EditController < BaseOqsController
|
||||
if params[:type] == 'oqs'
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
||||
elsif
|
||||
elsif params[:type] == "pending"
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
|
||||
.where("bko.order_id = '#{assigned_item.order_id}'").first()
|
||||
|
||||
@@ -103,11 +103,11 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
}
|
||||
|
||||
# begin
|
||||
if params[:order_source] == "quick_service"
|
||||
customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
else
|
||||
# if params[:order_source] == "quick_service"
|
||||
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
# else
|
||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||
end
|
||||
# end
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
|
||||
61
app/controllers/origami/jcb_controller.rb
Executable file → Normal file
61
app/controllers/origami/jcb_controller.rb
Executable file → Normal file
@@ -5,33 +5,43 @@ class Origami::JcbController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
# limit jcb_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = 0
|
||||
@jcbcount = 0
|
||||
others = 0
|
||||
|
||||
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
@rounding_adj = 0
|
||||
@can_jcb = 0
|
||||
@member_discount= 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "jcb"
|
||||
@jcbcount = @jcbcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_jcb = total - @jcbcount - others
|
||||
others = 0
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "jcb"
|
||||
@jcbcount = @jcbcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_jcb = total - @jcbcount - others
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@@ -59,4 +69,9 @@ class Origami::JcbController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
58
app/controllers/origami/master_controller.rb
Executable file → Normal file
58
app/controllers/origami/master_controller.rb
Executable file → Normal file
@@ -5,32 +5,41 @@ class Origami::MasterController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
# limit master_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = 0
|
||||
@mastercount = 0
|
||||
others = 0
|
||||
|
||||
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
@rounding_adj = 0
|
||||
@can_master = 0
|
||||
@member_discount = 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "master"
|
||||
@mastercount = @mastercount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
others = 0
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "master"
|
||||
@mastercount = @mastercount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_master = total - @mastercount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
@can_master = total - @mastercount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@@ -58,4 +67,9 @@ class Origami::MasterController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
61
app/controllers/origami/mpu_controller.rb
Executable file → Normal file
61
app/controllers/origami/mpu_controller.rb
Executable file → Normal file
@@ -4,33 +4,43 @@ class Origami::MpuController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
# limit mpu_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = 0
|
||||
@mpucount = 0
|
||||
others = 0
|
||||
|
||||
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
@rounding_adj = 0
|
||||
@can_mpu = 0
|
||||
@member_discount = 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "mpu"
|
||||
@mpucount = @mpucount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_mpu = total - @mpucount - others
|
||||
others = 0
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "mpu"
|
||||
@mpucount = @mpucount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_mpu = total - @mpucount - others
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@@ -58,4 +68,9 @@ class Origami::MpuController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -177,8 +177,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,table_id)
|
||||
# Order.pay_process_order_queue(order.order_id, table_id)
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.pay_process_order_queue(order.order_id, table_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#for card sale data
|
||||
@@ -427,12 +430,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
current_balance = nil
|
||||
order_source = params[:type]
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
if saleObj.discount_type == "member_discount"
|
||||
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,order_source)
|
||||
end
|
||||
|
||||
saleObj.update_attributes(rounding_adjustment: 0)
|
||||
|
||||
@@ -13,7 +13,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
|
||||
@@ -76,11 +76,14 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
|
||||
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
|
||||
order = Order.find(order_id)
|
||||
|
||||
action_by = current_user.id
|
||||
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
|
||||
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
||||
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
|
||||
end
|
||||
|
||||
@@ -141,7 +144,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
|
||||
|
||||
ProductCommission.edit_product_commission(saleitemObj)
|
||||
end
|
||||
@@ -162,17 +165,21 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# re-calc tax
|
||||
saleObj = Sale.find(saleitemObj.sale_id)
|
||||
|
||||
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
|
||||
order = Order.find(order_id)
|
||||
|
||||
action_by = current_user.id
|
||||
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
|
||||
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
|
||||
ProductCommission.remove_product_commission(saleitemObj)
|
||||
end
|
||||
|
||||
# remove all void items
|
||||
def cancel_all_void
|
||||
sale_id = params[:sale_id]
|
||||
order_source = params[:type]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.sale_items.each do |item|
|
||||
if item.qty.to_i < 0
|
||||
@@ -185,13 +192,14 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# re-calc tax
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
|
||||
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order_source)
|
||||
end
|
||||
|
||||
def apply_void
|
||||
sale_id = params[:sale_id]
|
||||
order_source = params[:type]
|
||||
saleObj = Sale.find(sale_id)
|
||||
saleObj.compute_without_void
|
||||
saleObj.compute_without_void(order_source)
|
||||
saleObj.sale_items.each do |item|
|
||||
ProductCommission.remove_product_commission(item)
|
||||
end
|
||||
|
||||
@@ -4,32 +4,40 @@ class Origami::UnionpayController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
# limit unionpay_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = 0
|
||||
@unionpaycount = 0
|
||||
others = 0
|
||||
|
||||
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
@rounding_adj = 0
|
||||
@can_unionpay = 0
|
||||
@member_discount = 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
others = 0
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "unionpay"
|
||||
@unionpaycount = @unionpaycount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "unionpay"
|
||||
@unionpaycount = @unionpaycount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_unionpay = total - @unionpaycount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
@can_unionpay = total - @unionpaycount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@@ -58,4 +66,9 @@ class Origami::UnionpayController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
57
app/controllers/origami/visa_controller.rb
Executable file → Normal file
57
app/controllers/origami/visa_controller.rb
Executable file → Normal file
@@ -4,32 +4,40 @@ class Origami::VisaController < BaseOrigamiController
|
||||
@cashier_type = params[:type]
|
||||
# limit visa_amount
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
total = sale_data.grand_total
|
||||
total = 0
|
||||
@visacount = 0
|
||||
others = 0
|
||||
|
||||
@payment_method_setting_nav = PaymentMethodSetting.all
|
||||
@shop = Shop::ShopDetail
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
@rounding_adj = 0
|
||||
@can_visa = 0
|
||||
@member_discount = 0
|
||||
@sub_total = 0
|
||||
@membership_id = nil
|
||||
@receipt_no = nil
|
||||
if !sale_data.nil?
|
||||
total = sale_data.grand_total
|
||||
others = 0
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@visacount = @visacount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
if @shop.is_rounding_adj
|
||||
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||
else
|
||||
new_total = sale_data.grand_total
|
||||
end
|
||||
@rounding_adj = new_total-sale_data.grand_total
|
||||
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
@visacount = @visacount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
end
|
||||
end
|
||||
@can_visa = total - @visacount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
end
|
||||
@can_visa = total - @visacount - others
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@sub_total = sale_data.total_amount
|
||||
@membership_id = sale_data.customer.membership_id
|
||||
#for bank integration
|
||||
@receipt_no = sale_data.receipt_no
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
@bank_integration = 0
|
||||
if !bank_integration[0].nil?
|
||||
@@ -58,4 +66,9 @@ class Origami::VisaController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,12 +4,13 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
remark = params[:remark]
|
||||
order_source = params[:type] #tax profile source
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
if sale.discount_type == "member_discount"
|
||||
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,order_source)
|
||||
end
|
||||
|
||||
# update count for shift sale
|
||||
|
||||
@@ -7,12 +7,9 @@ class Settings::MenusController < ApplicationController
|
||||
def index
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
# format.csv { send_data MenuCsvExport.generate }
|
||||
|
||||
format.csv { send_data Menu.to_csv }
|
||||
# format.csv { send_data MenuCategory.to_csv }
|
||||
end
|
||||
format.html
|
||||
format.xlsx
|
||||
end
|
||||
end
|
||||
|
||||
# GET /settings/menus/1
|
||||
@@ -76,7 +73,7 @@ format.csv { send_data Menu.to_csv }
|
||||
|
||||
def import
|
||||
Menu.import(params[:file])
|
||||
redirect_to settings_menu_path, notice: "imported"
|
||||
redirect_to settings_menus_path, notice: "imported"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Menu < ApplicationRecord
|
||||
|
||||
require 'spreadsheet'
|
||||
has_many :menu_categories, dependent: :destroy
|
||||
|
||||
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
|
||||
@@ -34,7 +36,7 @@ class Menu < ApplicationRecord
|
||||
|
||||
def self.to_csv
|
||||
m_attributes = %w{name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at}
|
||||
CSV.generate(headers: true) do |csv|
|
||||
CSV.generate(headers: true, row_sep: "\r\n") do |csv|
|
||||
csv << m_attributes
|
||||
menu = Menu.all
|
||||
menu.each do |user|
|
||||
@@ -44,8 +46,38 @@ class Menu < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.import(file)
|
||||
CSV.foreach(file.path, headers:true) do |row|
|
||||
Menu.create! row.to_hash
|
||||
spreadsheet = Roo::Spreadsheet.open(file.path)
|
||||
|
||||
spreadsheet = Roo::Excelx.new(file.path)
|
||||
|
||||
# Use the extension option if the extension is ambiguous.
|
||||
spreadsheet = Roo::Spreadsheet.open(file.path, extension: :xlsx)
|
||||
|
||||
puts spreadsheet.info
|
||||
|
||||
header = spreadsheet.row(1)
|
||||
|
||||
(2..spreadsheet.last_row).each do |i|
|
||||
|
||||
row = Hash[[header,spreadsheet.row(i)].transpose]
|
||||
|
||||
menu = Menu.new
|
||||
menu.name = row["name"]
|
||||
menu.is_active = row["is_active"]
|
||||
menu.valid_days = row["valid_days"]
|
||||
menu.valid_time_from = row["valid_time_from"]
|
||||
menu.valid_time_to = row["valid_time_to"]
|
||||
menu.created_by = row["created_by"]
|
||||
menu.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.open_spreadsheet(file)
|
||||
case File.extname(file.original_filename)
|
||||
when ".csv" then Roo::CSV.new(file.path,nil,:ignore)
|
||||
when ".xls" then Roo::Excel.new(file.path,nil,:ignore)
|
||||
when ".xlsx" then Roo::Excelx.new(file.path,nil,:ignore)
|
||||
else raise "Unknown File type: #{original_filename}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -71,9 +71,9 @@ class Order < ApplicationRecord
|
||||
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||
|
||||
#Send order to queue one it done!
|
||||
if self.source != "quick_service"
|
||||
# if self.source != "quick_service"
|
||||
process_order_queue
|
||||
end
|
||||
# end
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast(booking)
|
||||
@@ -297,7 +297,7 @@ class Order < ApplicationRecord
|
||||
else
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, self.table_id)
|
||||
oqs.process_order(order, self.table_id, self.source)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
@@ -313,7 +313,7 @@ class Order < ApplicationRecord
|
||||
else
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, self.table_id)
|
||||
oqs.process_order(order, self.table_id, self.source)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
@@ -326,7 +326,7 @@ class Order < ApplicationRecord
|
||||
else
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, self.table_id)
|
||||
oqs.process_order(order, self.table_id, self.source)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
|
||||
@@ -13,7 +13,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :station_name, :printer_name
|
||||
|
||||
def process_order (order, table_id)
|
||||
def process_order (order, table_id, order_source = nil)
|
||||
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
@@ -55,7 +55,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs.auto_print && order_source != "quick_service"
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
@@ -90,6 +90,80 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
if oqs.auto_print && order_source != "quick_service"
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end #end else
|
||||
end
|
||||
|
||||
def pay_process_order_queue (order_id, table_id)
|
||||
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
order = Order.find(order_id)
|
||||
order_items = order.order_items
|
||||
|
||||
if table_id.to_i > 0
|
||||
# get dining
|
||||
dining = DiningFacility.find(table_id)
|
||||
oqs_by_zones = OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}")
|
||||
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# ToDo per item per printer
|
||||
|
||||
oqs_by_zones.each do |oqpbz|
|
||||
oqs = OrderQueueStation.find(oqpbz.order_queue_station_id)
|
||||
is_auto_printed = false
|
||||
oqs_order_items = []
|
||||
|
||||
if oqs.is_active
|
||||
#Get List of items -
|
||||
pq_items = JSON.parse(oqs.processing_items)
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
if (order_item.qty > 0)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
oqs_stations.each do |oqs|
|
||||
is_auto_printed = false
|
||||
oqs_order_items = []
|
||||
|
||||
if oqs.is_active
|
||||
#Get List of items -
|
||||
pq_items = JSON.parse(oqs.processing_items)
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
if (order_item.qty > 0)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
|
||||
@@ -26,7 +26,7 @@ class Sale < ApplicationRecord
|
||||
SALE_STATUS_OUTSTANDING = "outstanding"
|
||||
SALE_STATUS_COMPLETED = "completed"
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil)
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -36,9 +36,9 @@ class Sale < ApplicationRecord
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
if booking.sale_id
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source)
|
||||
else
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source)
|
||||
end
|
||||
booking.sale_id = sale_id
|
||||
end
|
||||
@@ -58,7 +58,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil)
|
||||
def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil, order_source = nil)
|
||||
taxable = true
|
||||
#if sale_id is exsit and validate
|
||||
#add order to that invoice
|
||||
@@ -128,7 +128,7 @@ class Sale < ApplicationRecord
|
||||
self.save!
|
||||
|
||||
#compute sales summary
|
||||
compute
|
||||
compute(order_source)
|
||||
|
||||
#Update the order items that is billed
|
||||
order.update_items_status_to_billed(nil)
|
||||
@@ -172,7 +172,7 @@ class Sale < ApplicationRecord
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee,current_user)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee,current_user,order.source)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@@ -310,7 +310,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
#compute - invoice total
|
||||
def compute
|
||||
def compute(order_source = nil)
|
||||
sales_items = self.sale_items
|
||||
|
||||
#Computation Fields
|
||||
@@ -329,7 +329,7 @@ class Sale < ApplicationRecord
|
||||
# total_taxable = total_taxable + (item.taxable_price * item.qty)
|
||||
end
|
||||
|
||||
apply_tax (total_taxable)
|
||||
apply_tax(total_taxable, order_source)
|
||||
|
||||
self.total_amount = subtotal_price
|
||||
self.total_discount = total_discount
|
||||
@@ -342,7 +342,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
#compute - invoice total
|
||||
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil)
|
||||
def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil)
|
||||
|
||||
sale = Sale.find(sale_id)
|
||||
sales_items = sale_itemss
|
||||
@@ -362,7 +362,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
compute_tax(sale, total_taxable, total_discount)
|
||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
||||
sale.total_amount = subtotal_price
|
||||
sale.total_discount = total_discount
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
|
||||
@@ -376,7 +376,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
# No Use too many wrong
|
||||
def compute_without_void
|
||||
def compute_without_void(order_source = nil)
|
||||
sales_items = self.sale_items
|
||||
|
||||
#Computation Fields
|
||||
@@ -396,7 +396,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
apply_tax (total_taxable)
|
||||
apply_tax(total_taxable, order_source)
|
||||
self.total_amount = subtotal_price
|
||||
self.total_discount = total_discount
|
||||
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
|
||||
@@ -407,7 +407,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
# Tax Re-Calculte
|
||||
def compute_tax(sale, total_taxable, total_discount = 0)
|
||||
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil)
|
||||
shop = Shop.first();
|
||||
|
||||
#if tax is not apply create new record
|
||||
@@ -423,8 +423,9 @@ class Sale < ApplicationRecord
|
||||
# #Creat new tax records
|
||||
if sale.payment_status != 'foc'
|
||||
tax_profiles.each do |tax|
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
# customer.tax_profiles.each do |cus_tax|
|
||||
# if cus_tax.to_i == tax.id
|
||||
if tax.group_type.to_s == order_source.to_s
|
||||
sale_tax = SaleTax.new(:sale => sale)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
@@ -447,15 +448,16 @@ class Sale < ApplicationRecord
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
sale.total_tax = total_tax_amount
|
||||
end
|
||||
|
||||
# Tax Calculate
|
||||
def apply_tax(total_taxable)
|
||||
def apply_tax(total_taxable, order_source = nil)
|
||||
shop = Shop.first();
|
||||
|
||||
#if tax is not apply create new record
|
||||
@@ -469,11 +471,14 @@ class Sale < ApplicationRecord
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
|
||||
customer = Customer.find(self.customer_id)
|
||||
|
||||
if order_source.to_s == "emenu"
|
||||
order_source = "cashier"
|
||||
end
|
||||
#Create new tax records
|
||||
tax_profiles.each do |tax|
|
||||
customer.tax_profiles.each do |cus_tax|
|
||||
if cus_tax.to_i == tax.id
|
||||
# customer.tax_profiles.each do |cus_tax|
|
||||
# if cus_tax.to_i == tax.id
|
||||
if tax.group_type.to_s == order_source.to_s
|
||||
sale_tax = SaleTax.new(:sale => self)
|
||||
sale_tax.tax_name = tax.name
|
||||
sale_tax.tax_rate = tax.rate
|
||||
@@ -497,8 +502,9 @@ class Sale < ApplicationRecord
|
||||
|
||||
sale_tax.inclusive = tax.inclusive
|
||||
sale_tax.save
|
||||
end
|
||||
end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
self.total_tax = total_tax_amount
|
||||
end
|
||||
@@ -1963,7 +1969,7 @@ end
|
||||
end
|
||||
|
||||
# Re-compute for add
|
||||
saleobj.compute
|
||||
saleobj.compute(order.source)
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
@@ -1993,7 +1999,7 @@ end
|
||||
end
|
||||
|
||||
# Re-compute for add
|
||||
saleobj.compute
|
||||
saleobj.compute(order.source)
|
||||
saleobj.save
|
||||
order.save
|
||||
booking.save
|
||||
|
||||
@@ -325,6 +325,7 @@ class SalePayment < ApplicationRecord
|
||||
sObj = Sale.find(self.sale_id)
|
||||
is_credit = 0
|
||||
is_foc = 0
|
||||
is_cash = false
|
||||
sObj.sale_payments.each do |spay|
|
||||
all_received_amount += spay.payment_amount.to_f
|
||||
if spay.payment_method == "creditnote"
|
||||
@@ -333,8 +334,12 @@ class SalePayment < ApplicationRecord
|
||||
if spay.payment_method == "foc"
|
||||
is_foc = 1
|
||||
end
|
||||
if spay.payment_method.to_s == "cash"
|
||||
is_cash = true
|
||||
end
|
||||
end
|
||||
if (self.sale.grand_total <= all_received_amount)
|
||||
|
||||
if (self.sale.grand_total <= all_received_amount) && is_cash
|
||||
if is_credit == 0
|
||||
self.sale.payment_status = "paid"
|
||||
else
|
||||
@@ -374,11 +379,15 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
|
||||
if check_foc
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
elsif paid_amount.to_f > 0 #|| paid_amount != "0.0"
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
elsif is_cash && paid_amount.to_f == 0
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
end
|
||||
end
|
||||
|
||||
@@ -144,9 +144,12 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var booking_id = '<%= @booking.booking_id %>';
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% elsif @link_type == 'pending' %>
|
||||
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
|
||||
@@ -913,7 +913,7 @@
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
|
||||
@@ -705,7 +705,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').text();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
@@ -913,7 +913,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
url: "/origami/payment/"+cashier_type+"/foc",
|
||||
data: params,
|
||||
success:function(result){
|
||||
customer_display_view(null,"reload");
|
||||
|
||||
0
app/views/origami/pending_order/index.html.erb
Executable file → Normal file
0
app/views/origami/pending_order/index.html.erb
Executable file → Normal file
@@ -97,13 +97,15 @@
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@order_items.each do |order_item|
|
||||
sub_total = sub_total + order_item.price %>
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.price %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
@@ -210,7 +212,7 @@ $(document).ready(function(){
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -889,7 +889,7 @@ $('#add_invoice').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';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
|
||||
@@ -331,7 +331,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
data: 'sale_id=' + sale_id +'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
@@ -345,7 +345,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
|
||||
@@ -261,7 +261,7 @@ $('#void').on('click',function () {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
@@ -291,7 +291,7 @@ $('#foc').click(function() {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
url: "/origami/payment/cashier/foc",
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<!-- <h4>Import</h4>
|
||||
<h4>Import</h4>
|
||||
<%= form_tag import_settings_menus_path, multipart:true do%>
|
||||
<%=file_field_tag :file%>
|
||||
<%=submit_tag "Import CSV"%>
|
||||
<%end%> -->
|
||||
<%end%>
|
||||
<%= link_to "Export users as spreadsheet", settings_menus_path(format: "xlsx") %>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
|
||||
<br><br>
|
||||
|
||||
86
app/views/settings/menus/index.xlsx.axlsx
Normal file
86
app/views/settings/menus/index.xlsx.axlsx
Normal file
@@ -0,0 +1,86 @@
|
||||
wb = xlsx_package.workbook
|
||||
wb.styles do |s|
|
||||
date = s.add_style(:format_code => "yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER)
|
||||
wrap_text = s.add_style :sz => 11,
|
||||
:alignment => { :horizontal => :left,:vertical => :center ,
|
||||
:wrap_text => true}
|
||||
header_text = s.add_style :fg_color=> "FFFFFF",
|
||||
:b => true,
|
||||
:bg_color => "004586",
|
||||
:sz => 12,
|
||||
:border => { :style => :thin, :color => "00" },
|
||||
:alignment => { :horizontal => :left,
|
||||
:vertical => :center ,
|
||||
:header_text => true}
|
||||
|
||||
wb.add_worksheet(name: "Menu") do |sheet|
|
||||
sheet.add_row %w( name is_active valid_days valid_time_from valid_time_to created_by ), :style=>header_text
|
||||
@settings_menus.each do |menu|
|
||||
sheet.add_row [ menu.name, menu.is_active, menu.valid_days, menu.valid_time_from,menu.valid_time_to, menu.created_by], :style=>[date,wrap_text]
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Category") do |sheet|
|
||||
sheet.add_row %w(menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at), :style=>header_text
|
||||
MenuCategory.all.each do |mc|
|
||||
sheet.add_row [mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available, mc.created_at, mc.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item") do |sheet|
|
||||
sheet.add_row %w(item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id _qty taxable is_sub_item is_available created_by created_at updated_at), :style=>header_text
|
||||
MenuItem.all.each do |mi|
|
||||
sheet.add_row [mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by, mi.created_at, mi.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Instance") do |sheet|
|
||||
sheet.add_row %w(menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default created_at updated_at), :style=>header_text
|
||||
MenuItemInstance.all.each do |mii|
|
||||
sheet.add_row [mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default, mii.created_at, mii.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Options") do |sheet|
|
||||
sheet.add_row %w(option_type name value created_at updated_at), :style=>header_text
|
||||
MenuItemOption.all.each do |option|
|
||||
sheet.add_row [option.option_type, option.name, option.value, option.created_at, option.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Item Attributes") do |sheet|
|
||||
sheet.add_row %w(attribute_type name value created_at updated_at), :style=>header_text
|
||||
MenuItemAttribute.all.each do |attr|
|
||||
sheet.add_row [ attr.attribute_type,attr.name,attr.value,attr.created_at,attr.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Account") do |sheet|
|
||||
sheet.add_row %w(title account_type discount point bonus rebate created_at updated_at), :style=>header_text
|
||||
Account.all.each do |acc|
|
||||
sheet.add_row [acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate,acc.created_at,acc.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Item Set") do |sheet|
|
||||
sheet.add_row %w(name alt_name min_selectable_qty max_selectable_qty created_at updated_at), :style=>header_text
|
||||
ItemSet.all.each do |set|
|
||||
sheet.add_row [set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty, set.created_at, set.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Instance Item Set") do |sheet|
|
||||
sheet.add_row %w(item_set_id menu_item_instance_id created_at updated_at), :style=>header_text
|
||||
MenuInstanceItemSet.all.each do |miis|
|
||||
sheet.add_row [miis.item_set_id, miis.menu_item_instance_id, miis.created_at, miis.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
wb.add_worksheet(name: "Menu Item Set") do |sheet|
|
||||
sheet.add_row %w(item_set_id menu_item_id created_at updated_at), :style=>header_text
|
||||
MenuItemSet.all.each do |mis|
|
||||
sheet.add_row [mis.item_set_id, mis.menu_item_id, mis.created_at, mis.updated_at], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,7 @@ require_relative 'boot'
|
||||
|
||||
require 'csv'
|
||||
require 'rails/all'
|
||||
# require 'iconv'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
Mime::Type.register 'application/vnd.ms-excel', :xls
|
||||
Mime::Type.register "application/xlsx", :xlsx
|
||||
|
||||
@@ -170,7 +170,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get 'sale/:sale_id/:type/payment' => 'payments#show'
|
||||
post 'sale/:sale_id/:type/payment/print' => 'payments#print' #route for print receipt
|
||||
|
||||
post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||
post 'payment/:type/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||
post 'payment/cash' => 'payments#create'
|
||||
post 'payment/mpu' => "mpu#create"
|
||||
post 'payment/jcb' => "jcb#create"
|
||||
@@ -194,7 +194,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index"
|
||||
|
||||
#---------Void --------------#
|
||||
post 'sale/:sale_id/void' => 'void#overall_void'
|
||||
post 'sale/:sale_id/:type/void' => 'void#overall_void'
|
||||
|
||||
#---------Multiple Invoices --------------#
|
||||
get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index"
|
||||
|
||||
Reference in New Issue
Block a user