Fix bugs and improvements

fix payment outstanding with amount <= 0
fix payment outstanding with other payments
This commit is contained in:
Thein Lin Kyaw
2019-12-18 15:41:18 +06:30
parent e6392c3bd4
commit 92e467d512
11 changed files with 122 additions and 217 deletions

View File

@@ -6,6 +6,8 @@ class Booking < ApplicationRecord
belongs_to :dining_facility, :optional => true
belongs_to :sale, :optional => true
has_one :cashier_terminal_by_dining_facility, through: :dining_facility, source: :cashier_terminal
has_one :current_shift_by_dining_facility, through: :dining_facility, source: :current_shift
has_many :booking_orders
has_many :orders, :through => :booking_orders
has_many :order_items, :through => :orders do
@@ -13,7 +15,7 @@ class Booking < ApplicationRecord
sale_items = []
proxy_association.load_target.select(&:order_items_id).each do |order_item|
menu_category = order_item.menu_category || OpenStruct.new(name: 'Product', code: '') #get menu category for menu items
sale_items << SaleItem.new({
menu_category_name: menu_category.name,
menu_category_code: menu_category.code,