Class: Skr::SalesOrder

Inherits:
Model
  • Object
show all
Defined in:
lib/skr/sales_order.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SalesOrder

Returns a new instance of SalesOrder.



106
107
108
109
# File 'lib/skr/sales_order.rb', line 106

def initialize(attributes = {})
    super
    self.order_date = Date.today
end

Class Method Details

.sales_history(ndays) ⇒ Array of Array[day_ago,date, order_count,line_count,total]

Returns:

  • (Array of Array[day_ago,date, order_count,line_count,total])


87
88
89
90
# File 'lib/skr/sales_order.rb', line 87

def self.sales_history( ndays )
    qry = "select * from #{Skr::Core.config.table_prefix}so_dailly_sales_history where days_ago<#{ndays.to_i}"
    connection.execute(qry).values
end