Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -7,10 +7,11 @@ class AssignedOrderItem < ApplicationRecord
|
||||
belongs_to :order
|
||||
belongs_to :order_queue_station
|
||||
|
||||
def self.assigned_order_item (order, item_code, order_queue_station )
|
||||
def self.assigned_order_item (order, item_code, instance_code, order_queue_station )
|
||||
assigned_order_item = AssignedOrderItem.new()
|
||||
assigned_order_item.order = order
|
||||
assigned_order_item.item_code = item_code
|
||||
assigned_order_item.instance_code = instance_code
|
||||
assigned_order_item.order_queue_station = order_queue_station
|
||||
assigned_order_item.print_status = false
|
||||
assigned_order_item.delivery_status = false
|
||||
@@ -23,7 +24,7 @@ class AssignedOrderItem < ApplicationRecord
|
||||
oqs.id as station_id, oqs.station_name,
|
||||
oqs.is_active, oqpz.zone_id,
|
||||
df.name as zone, df.type as table_type,
|
||||
odt.order_id, odt.item_code, odt.item_name,
|
||||
odt.order_id, odt.item_code, odt.item_instance_code, odt.item_name,
|
||||
odt.price, odt.qty, odt.item_order_by, odt.options,
|
||||
cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
|
||||
@@ -45,14 +45,14 @@ class Booking < ApplicationRecord
|
||||
if filter.blank?
|
||||
keyword = ''
|
||||
else
|
||||
keyword = "booking_id LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%"
|
||||
keyword = "booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%"
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to)
|
||||
query = sale.where(keyword)
|
||||
booking = Booking.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to)
|
||||
query = booking.where(keyword)
|
||||
else
|
||||
where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",)
|
||||
where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
# else
|
||||
|
||||
if (order_item.price != 0)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, order_item.item_instance_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
# end
|
||||
|
||||
@@ -605,7 +605,7 @@ end
|
||||
|
||||
def self.get_item_query()
|
||||
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code, " +
|
||||
"(SUM(i.qty * i.unit_price)) as grand_total,SUM(i.qty) as total_item," +
|
||||
"(i.qty * i.unit_price) as grand_total,(i.qty) as total_item," +
|
||||
" i.unit_price as unit_price,i.product_name as product_name, mc.name as" +
|
||||
" menu_category_name,mc.id as menu_category_id ")
|
||||
|
||||
@@ -617,7 +617,7 @@ def self.get_item_query()
|
||||
|
||||
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
query = query.where("i.unit_price > 0")
|
||||
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")
|
||||
query = query.group("i.item_instance_code").order("mi.account_id, mi.menu_category_id")
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status)
|
||||
|
||||
@@ -264,8 +264,6 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def sale_update_payment_status(paid_amount)
|
||||
puts paid_amount
|
||||
puts "parid Masssssssssssssssssssssssssssssssssssssssss"
|
||||
#update amount_outstanding
|
||||
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
||||
self.sale.save!
|
||||
@@ -316,8 +314,6 @@ class SalePayment < ApplicationRecord
|
||||
self.sale.rebate_status = nil
|
||||
end
|
||||
end
|
||||
puts "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"
|
||||
puts response.to_json
|
||||
end
|
||||
|
||||
self.sale.save!
|
||||
@@ -375,7 +371,8 @@ class SalePayment < ApplicationRecord
|
||||
paypar.each do |pp|
|
||||
if pp.payment_method == "paypar"
|
||||
payparcost = payparcost + pp.payment_amount
|
||||
elsif pp.payment_method == "creditnote"
|
||||
end
|
||||
if pp.payment_method == "creditnote"
|
||||
credit = 1
|
||||
end
|
||||
end
|
||||
@@ -410,7 +407,9 @@ class SalePayment < ApplicationRecord
|
||||
rescue SocketError
|
||||
response = { "status": false, "message": "Can't connect server"}
|
||||
end
|
||||
|
||||
puts response.to_json
|
||||
puts payparcost
|
||||
puts overall_dis
|
||||
redeem_amount = payparcost + overall_dis
|
||||
|
||||
total_percentage = 0
|
||||
@@ -431,15 +430,19 @@ class SalePayment < ApplicationRecord
|
||||
data = {:type => a[:type], :amount => a[:amount]}
|
||||
type_arr.each do |si|
|
||||
if si[:type] == a[:type]
|
||||
amount = (redeem_amount / total_percentage)*si[:percentage]
|
||||
actual = a[:amount] - amount
|
||||
data[:amount] = actual
|
||||
if credit == 1
|
||||
data[:amount] = 0
|
||||
else
|
||||
amount = (redeem_amount / total_percentage)*si[:percentage]
|
||||
actual = a[:amount] - amount
|
||||
data[:amount] = actual
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
rebate_arr.push(data)
|
||||
end
|
||||
|
||||
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
|
||||
if credit == 1
|
||||
@@ -485,6 +488,7 @@ class SalePayment < ApplicationRecord
|
||||
response = { "status": "no_member", "message": "Not membership"}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user