commission report
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user