Class: ViewAccountingTransmission

Inherits:
ApplicationViewRecord show all
Includes:
Models::SearchableView
Defined in:
app/models/view_accounting_transmission.rb

Overview

== Schema Information

Table name: view_accounting_transmissions
Database name: primary

id :integer primary key
billing_entity_contact_point :string(255)
billing_entity_notification_channel :text
customer_full_name :string(255)
customer_notification_channel :text
doc_type :text
document_date :date
is_homeowner :boolean
order_ref :string
po_number :string
profile :string(255)
reference_number :string
rep :text
rma_funding :text
rma_number :string
rma_state :string
state :string
terms :string
total :decimal(, )
transmission_state :string(255)
transmission_type :text
customer_id :integer
order_id :integer
rma_id :integer

Instance Method Summary collapse

Methods included from Models::SearchableView

#crm_link, #crm_link_subtitle, #has_columns?, #main_resource, #readonly?

Methods inherited from ApplicationViewRecord

create, create!, #readonly?

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Method Details

#class_nameObject



35
36
37
38
39
40
41
42
43
44
# File 'app/models/view_accounting_transmission.rb', line 35

def class_name
	case doc_type
	when 'INV'
		'Invoice'
	when 'CM'
		'CreditMemo'
	when 'SOA'
		'StatementOfAccount'
	end
end

#unsent_communicationObject



46
47
48
49
50
# File 'app/models/view_accounting_transmission.rb', line 46

def unsent_communication
	return @unsent_communication if instance_variable_defined?(:@unsent_communication)

	@unsent_communication = Communication.where(resource_type: class_name, resource_id: id, state: ['draft', 'queued', 'exception']).first
end