Class: ViewInvoice
- Inherits:
-
ApplicationViewRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ApplicationViewRecord
- ViewInvoice
- Defined in:
- app/models/view_invoice.rb
Overview
== Schema Information
Table name: view_invoices
Database name: primary
id :integer primary key
buying_group_name :string(255)
company_name :string(255)
consolidated_currency :string
currency :string(255)
customer_name :string(255)
document_date :date
due_date :date
gl_date :date
invoice_type :string(255)
line_total :decimal(10, 2)
line_total_msrp :decimal(, )
local_sales_rep_full_name :string(255)
missing_edi_810 :boolean
opportunity_name :string(80)
primary_sales_rep_full_name :string(255)
profile_name :string(255)
profit_consolidated :decimal(8, 2)
reference_number :string(255)
report_grouping :string(255)
revenue_consolidated :decimal(8, 2)
secondary_sales_rep_full_name :string(255)
source_full_name :string(500)
state :string(255)
state_code :string(255)
technical_support_rep_full_name :string(255)
total :decimal(10, 2)
transmission_state :string(255)
created_at :datetime
buying_group_id :integer
company_id :integer
customer_id :integer
local_sales_rep_id :integer
opportunity_id :integer
order_id :integer
primary_sales_rep_id :integer
profile_id :integer
secondary_sales_rep_id :integer
source_id :integer
technical_support_rep_id :integer
Class Method Summary collapse
-
.missing_edi_invoice ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices that are missing edi invoice.
- .ransackable_scopes(_auth_object = nil) ⇒ Object
-
.report_grouping ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices that are report grouping.
-
.source_id ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices 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
.missing_edi_invoice ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices that are missing edi invoice. Active Record Scope
60 61 62 63 64 |
# File 'app/models/view_invoice.rb', line 60 scope :missing_edi_invoice, ->(*vals) { val = vals.flatten.first return all unless val.to_s == '1' where(missing_edi_810: true) } |
.ransackable_scopes(_auth_object = nil) ⇒ Object
80 81 82 |
# File 'app/models/view_invoice.rb', line 80 def self.ransackable_scopes(_auth_object = nil) super + %i[source_id missing_edi_invoice report_grouping] end |
.report_grouping ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices that are report grouping. Active Record Scope
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/models/view_invoice.rb', line 66 scope :report_grouping, ->(*vals) { values = vals.flatten.compact.uniq return all if values.blank? if values.include?('Any') where.not(report_grouping: nil) else values_with_nil = values.dup has_undefined = values_with_nil.delete('Undefined') values_with_nil << nil if has_undefined where(report_grouping: values_with_nil) end } |
.source_id ⇒ ActiveRecord::Relation<ViewInvoice>
A relation of ViewInvoices that are source id. Active Record Scope
52 53 54 55 56 57 58 |
# File 'app/models/view_invoice.rb', line 52 scope :source_id, ->(*sids) { sids = sids.flatten return all if sids.blank? = Source.self_and_descendants_ids(sids) where(source_id: ) } |