Class: ViewOrder
- Inherits:
-
ApplicationViewRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ApplicationViewRecord
- ViewOrder
- Includes:
- Models::SearchableView, Models::SearchableViewWithLineItems, PgSearch::Model
- Defined in:
- app/models/view_order.rb
Overview
== Schema Information
Table name: view_orders
Database name: primary
id :integer primary key
catalog_name :string(255)
company_name :string(255)
consolidated_currency :string
contact_full_name :string(255)
coupons :string(255) is an Array
credit_rma_number :string(255)
currency :string(255)
customer_full_name :string(255)
customer_reference :string(255)
estimated_cost :decimal(, )
estimated_profit_margin :decimal(, )
future_release_date :date
google_conversion_meta_result :text
has_future_release_date :boolean
has_pending_drop_ship_deliveries :boolean
has_rma :boolean
line_total :decimal(10, 2)
line_total_msrp :decimal(, )
local_sales_rep_full_name :string(255)
notes :text
opportunity_name :string(80)
order_by :integer
order_by_full_name :string(255)
order_reception_type :string(255)
order_type :string(255)
original_order_reference_number :string(255)
payment_amount :decimal(, )
po_number :string
primary_sales_rep_full_name :string(255)
recipient :string(255)
reference_number :string(255)
revenue_consolidated_at_time_of_checkout :decimal(10, 2)
rma_number :string(255)
secondary_sales_rep_full_name :string(255)
shipped_date :date
source_full_name :string(500)
spiff_rep_full_name :string(255)
state :string(255)
support_case_number :string
technical_support_rep_full_name :string(255)
total :decimal(10, 2)
created_at :datetime
updated_at :datetime
catalog_id :integer
company_id :integer
contact_id :integer
customer_id :integer
local_sales_rep_id :integer
opportunity_id :integer
original_order_id :integer
primary_sales_rep_id :integer
rma_id :integer
secondary_sales_rep_id :integer
source_id :integer
spiff_rep_id :integer
store_id :integer
support_case_id :integer
technical_support_rep_id :integer
Class Method Summary collapse
-
.contains_coupon_ids ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are contains coupon ids.
-
.delivery_state_in ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are delivery state in.
-
.google_conversion_meta_result_in ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are google conversion meta result in.
- .ransackable_scopes(_auth_object = nil) ⇒ Object
-
.source_id ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are source id.
Methods included from Models::SearchableViewWithLineItems
contains_item_ids, contains_product_category_ids, contains_product_line_ids, not_contains_item_ids, not_contains_product_category_ids, not_contains_product_line_ids
Methods included from Models::SearchableView
#crm_link, #crm_link_subtitle, #has_columns?, #main_resource, #readonly?
Methods inherited from ApplicationViewRecord
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.contains_coupon_ids ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are contains coupon ids. Active Record Scope
71 |
# File 'app/models/view_order.rb', line 71 scope :contains_coupon_ids, ->(coupon_ids) { where("EXISTS (select discounts.id from discounts where discounts.coupon_id IN (?) and discounts.itemizable_type = 'Order' and discounts.itemizable_id = view_orders.id)", coupon_ids) } |
.delivery_state_in ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are delivery state in. Active Record Scope
72 |
# File 'app/models/view_order.rb', line 72 scope :delivery_state_in, ->(delivery_state_ids) { where('EXISTS(select id from deliveries where deliveries.order_id = view_orders.id and deliveries.state IN (?))', delivery_state_ids) } |
.google_conversion_meta_result_in ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are google conversion meta result in. Active Record Scope
81 82 83 |
# File 'app/models/view_order.rb', line 81 scope :google_conversion_meta_result_in, ->(values) { where(google_conversion_meta_result: values) } |
.ransackable_scopes(_auth_object = nil) ⇒ Object
87 88 89 |
# File 'app/models/view_order.rb', line 87 def self.ransackable_scopes(_auth_object = nil) super + %i[source_id contains_coupon_ids delivery_state_in google_conversion_meta_result_in customer_full_name_search] end |
.source_id ⇒ ActiveRecord::Relation<ViewOrder>
A relation of ViewOrders that are source id. Active Record Scope
73 74 75 76 77 78 |
# File 'app/models/view_order.rb', line 73 scope :source_id, ->(*sids) { sids = sids.flatten.compact next all if sids.blank? where(source_id: Source.self_and_descendants_ids(sids)) } |