commission report
This commit is contained in:
@@ -9,7 +9,6 @@ class Commission < ApplicationRecord
|
||||
has_many :product_commissions
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
self.commission_id = SeedGenerator.generate_id(self.class.name, 'COM')
|
||||
end
|
||||
|
||||
@@ -5,5 +5,14 @@ class ProductCommission < ApplicationRecord
|
||||
belongs_to :sale_item, foreign_key: 'sale_item_id'
|
||||
belongs_to :sale, foreign_key: 'sale_id'
|
||||
|
||||
|
||||
def self.get_transaction(from, to, commissioner)
|
||||
transaction = self.all
|
||||
if !from.nil? && !to.nil?
|
||||
transaction = transaction.where('updated_at between ? and ?', from, to)
|
||||
end
|
||||
if commissioner != 0
|
||||
transaction = transaction.where(commissioner_id: commissioner)
|
||||
end
|
||||
return transaction
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ class Promotion < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.is_between_promo_datetime(current_day,current_time) #database is not local time
|
||||
promoList = Promotion.where("(TO_CHAR(promo_start_date, 'YYYY-MM-DD') <=? AND TO_CHAR(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
|
||||
promoList = Promotion.where("(date_format(promo_start_date, 'YYYY-MM-DD') <=? AND date_format(promo_end_date, 'YYYY-MM-DD') >=?) AND (promo_start_hour < ? AND promo_end_hour > ?)", current_day, current_day, current_time, current_time)
|
||||
return promoList
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user