change order reservation

This commit is contained in:
phyusin
2018-04-30 09:45:37 +06:30
19 changed files with 189 additions and 108 deletions

View File

@@ -78,6 +78,14 @@ class MenuCategory < ApplicationRecord
end
end
def get_sub_category
menu_category = MenuCategory.find_by_menu_category_id(self.id)
if menu_category
return true
end
return false
end
private
# def generate_menu_category_code

View File

@@ -5,9 +5,9 @@ class OrderReservation < ApplicationRecord
before_create :generate_custom_id
has_many :order_reservation_items
belongs_to :delivery
has_one :delivery
scope :latest_order, -> { order("order_reservation_id desc, requested_time asc") }
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
SEND_TO_KITCHEN = "send_to_kitchen"
READY_TO_DELIVERY = "ready_to_deliver"
@@ -21,7 +21,7 @@ class OrderReservation < ApplicationRecord
order_reservation = OrderReservation.new
order_reservation.order_reservation_type = order_reserve[:order_type]
order_reservation.customer_id = order_reserve[:cus_info]
order_reservation.requested_time = DateTime.parse(order_reserve[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
order_reservation.requested_time = DateTime.parse(order_reserve[:requested_time]).utc
order_reservation.callback_url = order_reserve[:callback_url]
order_reservation.transaction_ref = order_reserve[:reference]
if order_reserve[:order_info]

View File

@@ -23,6 +23,7 @@ class SalePayment < ApplicationRecord
if (amount_due >= 0)
payment_status = false
membership_data = nil
#route to payment type
case payment_method
when "cash"
@@ -52,11 +53,11 @@ class SalePayment < ApplicationRecord
when "foc"
payment_status = foc_payment
when "paymal"
payment_status = paymal_payment
payment_status,membership_data = paymal_payment
when "JunctionPay"
payment_status = junction_pay_payment
when "dinga"
payment_status = dinga_payment
payment_status,membership_data = dinga_payment
else
puts "it was something else"
end
@@ -73,7 +74,7 @@ class SalePayment < ApplicationRecord
end
end
return true, self.save
return true, self.save,membership_data
else
#record an payment in sale-audit
# remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
@@ -430,7 +431,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0)
end
return payment_status
return payment_status,membership_data
end
def junction_pay_payment
@@ -480,7 +481,7 @@ class SalePayment < ApplicationRecord
sale_update_payment_status(0)
end
return payment_status
return payment_status,membership_data
end