Class: TerminalsReport
Instance Attribute Summary
#report, #template
Instance Method Summary
collapse
#arelize, #human_calculation_name, #human_calculation_names, #human_condition_name, #human_condition_values, #human_field_name, #human_field_value, #human_groupping_field_names, #human_groupping_names, #initialize, #keyword, #query, requires_dates!, requires_dates?, #requires_dates?
Instance Method Details
#calculations ⇒ Object
112
113
114
115
116
|
# File 'app/reports/terminals_report.rb', line 112
def calculations
{
:quantity => lambda{|q, t| t.groupping.blank? ? q : q.project('COUNT(*) AS "quantity"') }
}.with_indifferent_access
end
|
#conditions ⇒ Object
118
119
120
121
122
|
# File 'app/reports/terminals_report.rb', line 118
def conditions
{
'terminal.condition' => proc { I18n.t('smartkiosk.terminal_conditions') }
}
end
|
#context(start, finish) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'app/reports/terminals_report.rb', line 12
def context(start, finish)
context = tables[:terminal]
[:agent, :terminal_profile].each do |x|
context = context.join(tables[x], Arel::Nodes::OuterJoin).on(tables[:terminal][x.to_s + '_id'].eq tables[x][:id])
end
context
end
|
#fields ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'app/reports/terminals_report.rb', line 32
def fields
{
'' => %w(
terminal.agent_id
agent.title
agent.juristic_name
agent.juristic_address_city
agent.juristic_address_street
agent.juristic_address_home
agent.physical_address_city
agent.physical_address_district
agent.physical_address_subway
agent.physical_address_street
agent.physical_address_home
agent.contact_name
agent.contact_info
agent.director_name
agent.director_contact_info
agent.bookkeeper_name
agent.bookkeeper_contact_info
agent.inn
agent.support_phone
terminal.keyword
terminal.address
terminal.version
terminal.issues_started_at
terminal.collected_at
terminal.printer_error
terminal.cash_acceptor_error
terminal.juristic_name
terminal.sector
terminal.contact_name
terminal.contact_phone
terminal.contact_email
terminal.schedule
terminal.juristic_name
terminal.contract_number
terminal.manager
terminal.rent
terminal.rent_finish_date
terminal.collection_zone
terminal.check_phone_number
),
'terminal.agent_id' => %w(
terminal.agent_id
agent.title
agent.juristic_name
agent.juristic_address_city
agent.juristic_address_street
agent.juristic_address_home
agent.physical_address_city
agent.physical_address_district
agent.physical_address_subway
agent.physical_address_street
agent.physical_address_home
agent.contact_name
agent.contact_info
agent.director_name
agent.director_contact_info
agent.bookkeeper_name
agent.bookkeeper_contact_info
agent.inn
agent.support_phone
),
'terminal.terminal_profile_id' => %w(
terminal.terminal_profile_id
terminal_profile.title
),
'terminal.printer_error' => %w(
terminal.printer_error
),
'terminal.cash_acceptor_error' => %w(
terminal.cash_acceptor_error
),
'terminal.version' => %w(
terminal.version
)
}
end
|
#groupping ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'app/reports/terminals_report.rb', line 22
def groupping
%w(
terminal.agent_id
terminal.terminal_profile_id
terminal.printer_error
terminal.cash_acceptor_error
terminal.version
)
end
|
#tables ⇒ Object
4
5
6
7
8
9
10
|
# File 'app/reports/terminals_report.rb', line 4
def tables
@tables ||= {
:terminal => Arel::Table.new(:terminals),
:agent => Arel::Table.new(:agents),
:terminal_profile => Arel::Table.new(:terminal_profiles)
}.with_indifferent_access
end
|