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

This commit is contained in:
Aung Myo
2017-07-02 12:08:09 +06:30
6 changed files with 38 additions and 25 deletions

View File

@@ -55,7 +55,7 @@ class SalePayment < ApplicationRecord
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1
aoi.save
@@ -287,7 +287,7 @@ class SalePayment < ApplicationRecord
bookings = table.bookings
bookings.each do |tablebooking|
if tablebooking.booking_status != 'moved'
if tablebooking.sale.sale_status != 'completed'
if tablebooking.sale.sale_status != 'completed' && tablebooking.sale.sale_status != 'void'
status = false
end
end
@@ -314,7 +314,7 @@ class SalePayment < ApplicationRecord
# overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount
total_amount = rebate_prices - payparcost + overall_dis
total_amount = rebate_prices - payparcost - overall_dis
if total_amount > 0
receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url")

View File

@@ -16,11 +16,17 @@ class ShiftSale < ApplicationRecord
belongs_to :cashier_terminal
belongs_to :employee, :foreign_key => 'employee_id'
def self.current_shift
today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take
return shift
end
def self.current_open_shift(current_user)
#if current_user
#find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
return shift
#end
end