Merge branch 'r-1902001-01-dev' of gitlab.com:code2lab/SXRestaurant into r-1902001-01-dev
This commit is contained in:
@@ -230,7 +230,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_order_queue(order_id,table_id,order_source)
|
def process_order_queue(order_id, table_id, order_source)
|
||||||
#Send to background job for processing
|
#Send to background job for processing
|
||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||||
|
|||||||
@@ -550,11 +550,14 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
current_balance = nil
|
current_balance = nil
|
||||||
order_source = params[:type]
|
order_source = params[:type]
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if Sale.exists?(sale_id)
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
#calculate cash acmount
|
#calculate cash acmount
|
||||||
cash = saleObj.total_amount
|
cash = saleObj.total_amount
|
||||||
|
|
||||||
|
sale_payment = SalePayment.new
|
||||||
|
sale_payment.process_payment(saleObj, current_user, cash, "foc" ,remark)
|
||||||
|
|
||||||
if saleObj.discount_type == "member_discount"
|
if saleObj.discount_type == "member_discount"
|
||||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||||
saleObj.compute_by_sale_items(0, nil, order_source)
|
saleObj.compute_by_sale_items(0, nil, order_source)
|
||||||
@@ -562,9 +565,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
saleObj.update_attributes(grand_total: 0, rounding_adjustment: 0, amount_received: 0, amount_changed: 0)
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
|
||||||
sale_payment.process_payment(saleObj, current_user, cash, "foc" ,remark)
|
|
||||||
|
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
@@ -573,8 +573,6 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Process order items and send to order queue
|
#Process order items and send to order queue
|
||||||
def self.process_order_queue(order_id,table_id,source)
|
def self.process_order_queue(order_id, table_id, source)
|
||||||
print_status = nil
|
print_status = nil
|
||||||
cup_status = nil
|
cup_status = nil
|
||||||
|
|
||||||
@@ -422,11 +422,10 @@ class Order < ApplicationRecord
|
|||||||
else
|
else
|
||||||
if order
|
if order
|
||||||
oqs = OrderQueueStation.new
|
oqs = OrderQueueStation.new
|
||||||
oqs.process_order(order, table_id, order_source)
|
oqs.process_order(order, table_id, source)
|
||||||
end
|
end
|
||||||
from = getCloudDomain #get sub domain in cloud mode
|
|
||||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||||
ActionCable.server.broadcast "order_queue_station_channel", order: assign_order, from: from
|
ActionCable.server.broadcast "order_queue_station_channel", order: assign_order
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -77,18 +77,26 @@ class SalePayment < ApplicationRecord
|
|||||||
if payment_for
|
if payment_for
|
||||||
invoice_sale_payments = SalePayment.get_sale_payment_for_credit(invoice)
|
invoice_sale_payments = SalePayment.get_sale_payment_for_credit(invoice)
|
||||||
amount_due = SalePayment.get_credit_amount_due_left(self.sale_id)[0] ? SalePayment.get_credit_amount_due_left(self.sale_id)[0].payment_amount.to_f : 0
|
amount_due = SalePayment.get_credit_amount_due_left(self.sale_id)[0] ? SalePayment.get_credit_amount_due_left(self.sale_id)[0].payment_amount.to_f : 0
|
||||||
|
puts "amount_due => #{amount_due}"
|
||||||
else
|
else
|
||||||
invoice_sale_payments = invoice.sale_payments
|
invoice_sale_payments = invoice.sale_payments
|
||||||
amount_due = invoice.grand_total
|
amount_due = invoice.grand_total
|
||||||
|
puts "amount_due => #{amount_due}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "amount_due => #{amount_due}"
|
||||||
|
|
||||||
invoice_sale_payments.each do |payment|
|
invoice_sale_payments.each do |payment|
|
||||||
if (payment.payment_status == "paid" )
|
if (payment.payment_status == "paid" )
|
||||||
amount_due = amount_due - payment.payment_amount
|
amount_due = amount_due - payment.payment_amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
puts "Cash Amount -> #{cash_amount}"
|
||||||
|
|
||||||
if (amount_due > 0)
|
puts "payment_method -> #{payment_method}"
|
||||||
|
|
||||||
|
puts "Amount Due => #{amount_due}"
|
||||||
|
if amount_due > 0
|
||||||
payment_status = false
|
payment_status = false
|
||||||
membership_data = nil
|
membership_data = nil
|
||||||
#route to payment type
|
#route to payment type
|
||||||
@@ -118,6 +126,7 @@ class SalePayment < ApplicationRecord
|
|||||||
when "paypar"
|
when "paypar"
|
||||||
payment_status = paypar_payment
|
payment_status = paypar_payment
|
||||||
when "foc"
|
when "foc"
|
||||||
|
puts ">>>>> FOC <<<<<"
|
||||||
payment_status = foc_payment
|
payment_status = foc_payment
|
||||||
when "paymal"
|
when "paymal"
|
||||||
payment_status,membership_data = paymal_payment
|
payment_status,membership_data = paymal_payment
|
||||||
@@ -418,19 +427,19 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
def foc_payment
|
def foc_payment
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
sale = self.sale
|
||||||
# add to sale item with foc
|
# add to sale item with foc
|
||||||
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
|
sale_items = sale.sale_items
|
||||||
|
|
||||||
sale_items.each do|item|
|
sale_items.each do|item|
|
||||||
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
SaleItem.update_existing_item(item.qty, item, sale.sale_id, "foc", item.unit_price, item.price)
|
||||||
end
|
end
|
||||||
sale = Sale.find(self.sale.sale_id)
|
|
||||||
sale.compute_by_sale_items(sale.total_discount,'','','',"foc")
|
sale.compute_by_sale_items(sale.total_discount,'','','',"foc")
|
||||||
|
|
||||||
self.payment_method = "foc"
|
self.payment_method = "foc"
|
||||||
self.payment_amount = self.received_amount
|
self.payment_amount = self.received_amount
|
||||||
# self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
|
||||||
self.outstanding_amount = 0.00
|
self.outstanding_amount = 0.00
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_status = self.save!
|
payment_status = self.save!
|
||||||
@@ -654,12 +663,12 @@ class SalePayment < ApplicationRecord
|
|||||||
is_foc = sale.sale_payments.any? { |x| x.payment_method == "foc" }
|
is_foc = sale.sale_payments.any? { |x| x.payment_method == "foc" }
|
||||||
|
|
||||||
if (sale.grand_total <= all_received_amount)
|
if (sale.grand_total <= all_received_amount)
|
||||||
|
sale.payment_status = "paid"
|
||||||
if is_credit
|
if is_credit
|
||||||
sale.payment_status = "outstanding"
|
sale.payment_status = "outstanding"
|
||||||
elsif is_foc
|
end
|
||||||
|
if is_foc
|
||||||
sale.payment_status = "foc"
|
sale.payment_status = "foc"
|
||||||
else
|
|
||||||
sale.payment_status = "paid"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sale.sale_status = "completed"
|
sale.sale_status = "completed"
|
||||||
|
|||||||
Reference in New Issue
Block a user