Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2018-03-30 15:25:15 +06:30
17 changed files with 325 additions and 40 deletions

View File

@@ -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")

View File

@@ -420,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