26 lines
1.0 KiB
Ruby
26 lines
1.0 KiB
Ruby
|
|
#Description
|
|
#total_revenue = sum of all sub-total from sales table
|
|
#total_discounts = sum of all discount (overall) from sales tables
|
|
#total_taxes = sum of all taxes from sales table (Service + Goverment Tax (commercial_taxes))
|
|
#grand_total = total_revenue - total_discounts + total_taxes
|
|
#nett_sales = grand_total - commercial_taxes
|
|
#cash_sales = cash payment total revenue
|
|
#credit_sales = credit payment total revenue
|
|
#others_sales = [Sum of each of other payment type --- mpu, jcb, visa,master, rebate, vochure]
|
|
#commercial_taxes = Total Goverment tax due
|
|
#cash_in = Payment receive
|
|
#Cash_out = Payment issues for misc payments
|
|
|
|
class ShiftSale < ApplicationRecord
|
|
belongs_to :cashier_terminal
|
|
belongs_to :employee
|
|
|
|
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
|
|
@shift = ShiftSale.where("cast(shift_started_at as date) = #{DateTime.now.to_date} and shift_started_at is null and employee_id = #{current_user.id}").limit(1)
|
|
#end
|
|
end
|
|
end
|