Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into ui_ux_changes
This commit is contained in:
@@ -179,6 +179,11 @@ class Ability
|
||||
can :remove_all_discount, :discount
|
||||
can :member_discount, :discount
|
||||
|
||||
can :move_dining, :movetable
|
||||
can :moving, :movetable
|
||||
|
||||
can :move_dining, :moveroom
|
||||
|
||||
can :manage, Customer
|
||||
can :manage, DiningQueue
|
||||
|
||||
|
||||
@@ -950,7 +950,7 @@ def self.get_menu_item_query(order_by)
|
||||
" LEFT JOIN sale_items si ON si.item_instance_code = mii.item_instance_code" +
|
||||
" LEFT JOIN sales s ON s.sale_id = si.sale_id")
|
||||
.where("(CASE WHEN s.sale_status IS NOT NULL THEN s.sale_status='completed' ELSE 1 END)")
|
||||
.group("mc.id, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE mii.item_instance_name END)")
|
||||
.group("mc.id, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE CONCAT(menu_items.name,' - ',mii.item_instance_name) END)")
|
||||
.order("si.qty #{order_by}, menu_items.menu_category_id #{order_by}")
|
||||
end
|
||||
#product sale report query
|
||||
@@ -1109,6 +1109,16 @@ def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type
|
||||
return all_total,sale_type
|
||||
end
|
||||
|
||||
def self.get_wastes_and_spoilages(from,to,status)
|
||||
if status == "spoile"
|
||||
type = "and sales.sale_status = 'spoile'"
|
||||
else
|
||||
type = "and sales.sale_status = 'waste'"
|
||||
end
|
||||
query = Sale.all.where("sales.receipt_date between ? and ? #{type}",from,to)
|
||||
.group("sales.receipt_no")
|
||||
end
|
||||
|
||||
# def self.get_separate_tax(from,to,payment_method=nil)
|
||||
|
||||
# query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||
|
||||
@@ -38,7 +38,8 @@ class SaleItem < ApplicationRecord
|
||||
sale_item.product_alt_name = item.product_alt_name
|
||||
sale_item.account_id = item.account_id
|
||||
sale_item.status = type
|
||||
if type == "foc" || type == "promotion" || type == "void"
|
||||
sale_item.remark = type
|
||||
if type == "foc" || type == "promotion" || type == "void" || type == "waste" || type == "spoile"
|
||||
sale_item.qty = qty * (-1)
|
||||
else
|
||||
sale_item.qty = qty
|
||||
|
||||
@@ -51,6 +51,8 @@ class SalePayment < ApplicationRecord
|
||||
payment_status = foc_payment
|
||||
when "JunctionPay"
|
||||
payment_status = junction_pay_payment
|
||||
when "alipay"
|
||||
payment_status = external_terminal_card_payment(:alipay)
|
||||
else
|
||||
puts "it was something else"
|
||||
end
|
||||
@@ -230,7 +232,7 @@ class SalePayment < ApplicationRecord
|
||||
payment_status = false
|
||||
self.payment_method = method
|
||||
self.payment_amount = self.received_amount
|
||||
self.payment_reference = self.card_payment_reference
|
||||
# self.payment_reference = self.card_payment_reference
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
@@ -418,7 +420,7 @@ class SalePayment < ApplicationRecord
|
||||
bookings.each do |tablebooking|
|
||||
if tablebooking.booking_status != 'moved'
|
||||
if tablebooking.sale_id
|
||||
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
|
||||
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void' && tablebooking.sale.sale_status != 'spoile' && tablebooking.sale.sale_status != 'waste'
|
||||
status = false
|
||||
sale_count += 1
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user