Class: Skr::SalesOrder
- Defined in:
- lib/skr/models/sales_order.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ SalesOrder
constructor
A new instance of SalesOrder.
Constructor Details
#initialize(attributes = {}) ⇒ SalesOrder
Returns a new instance of SalesOrder.
110 111 112 113 114 |
# File 'lib/skr/models/sales_order.rb', line 110 def initialize(attributes = {}) super # order date must be set, otherwise things like terms that are set from it fail self.order_date ||= Date.today end |
Class Method Details
.sales_history(ndays) ⇒ Array of Array[day_ago,date, order_count,line_count,total]
85 86 87 88 |
# File 'lib/skr/models/sales_order.rb', line 85 def self.sales_history( ndays ) qry = "select * from #{Skr.config.table_prefix}so_dailly_sales_history where days_ago<#{ndays.to_i}" connection.execute(qry).values end |