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.
115 116 117 118 119 |
# File 'lib/skr/models/sales_order.rb', line 115 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]
90 91 92 93 |
# File 'lib/skr/models/sales_order.rb', line 90 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 |