fossil 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. data/Rakefile +19 -0
  2. data/VERSION +1 -0
  3. data/fossil.gemspec +136 -0
  4. data/lib/models/ac_qualification.rb +91 -0
  5. data/lib/models/aircraft.rb +397 -0
  6. data/lib/models/aircraft_cost.rb +65 -0
  7. data/lib/models/aircraft_document.rb +41 -0
  8. data/lib/models/aircraft_log.rb +179 -0
  9. data/lib/models/aircraft_maint.rb +93 -0
  10. data/lib/models/aircraft_note.rb +115 -0
  11. data/lib/models/aircraft_rate.rb +124 -0
  12. data/lib/models/aircraft_time.rb +87 -0
  13. data/lib/models/aircraft_type.rb +159 -0
  14. data/lib/models/airport.rb +256 -0
  15. data/lib/models/airport_cost.rb +46 -0
  16. data/lib/models/airport_fbo.rb +98 -0
  17. data/lib/models/airport_fuel.rb +78 -0
  18. data/lib/models/airport_service.rb +90 -0
  19. data/lib/models/ap_operational_msg.rb +33 -0
  20. data/lib/models/audit_trail.rb +26 -0
  21. data/lib/models/btrieve_code_name.rb +104 -0
  22. data/lib/models/cargo.rb +39 -0
  23. data/lib/models/check_group.rb +17 -0
  24. data/lib/models/checklist.rb +98 -0
  25. data/lib/models/city_pair.rb +43 -0
  26. data/lib/models/code.rb +57 -0
  27. data/lib/models/comment.rb +30 -0
  28. data/lib/models/comments2.rb +20 -0
  29. data/lib/models/company_information.rb +565 -0
  30. data/lib/models/contact.rb +42 -0
  31. data/lib/models/contract.rb +53 -0
  32. data/lib/models/contract_item.rb +58 -0
  33. data/lib/models/cost_center.rb +16 -0
  34. data/lib/models/crew_activity.rb +42 -0
  35. data/lib/models/crew_currency_by_cct.rb +255 -0
  36. data/lib/models/crew_currency_gen.rb +84 -0
  37. data/lib/models/crew_duty.rb +128 -0
  38. data/lib/models/crew_history_item.rb +132 -0
  39. data/lib/models/crew_information.rb +137 -0
  40. data/lib/models/crew_leg.rb +127 -0
  41. data/lib/models/crew_training_group.rb +33 -0
  42. data/lib/models/crew_training_item.rb +146 -0
  43. data/lib/models/crew_training_log.rb +39 -0
  44. data/lib/models/crew_trip.rb +60 -0
  45. data/lib/models/currency_rate.rb +27 -0
  46. data/lib/models/exp_record.rb +75 -0
  47. data/lib/models/field_list.rb +25 -0
  48. data/lib/models/flight_log_expense.rb +90 -0
  49. data/lib/models/flt_cas.rb +52 -0
  50. data/lib/models/flt_crew.rb +80 -0
  51. data/lib/models/flt_data.rb +132 -0
  52. data/lib/models/flt_exp.rb +57 -0
  53. data/lib/models/flt_leg.rb +125 -0
  54. data/lib/models/group_cost.rb +22 -0
  55. data/lib/models/icaocode.rb +23 -0
  56. data/lib/models/language.rb +50 -0
  57. data/lib/models/leg_request.rb +39 -0
  58. data/lib/models/leg_time.rb +100 -0
  59. data/lib/models/logbook.rb +95 -0
  60. data/lib/models/maint_time.rb +44 -0
  61. data/lib/models/msg_itin.rb +42 -0
  62. data/lib/models/msg_trip.rb +56 -0
  63. data/lib/models/no_fly_list.rb +37 -0
  64. data/lib/models/note.rb +27 -0
  65. data/lib/models/one_cost.rb +98 -0
  66. data/lib/models/passenger.rb +336 -0
  67. data/lib/models/passenger_rate.rb +51 -0
  68. data/lib/models/passport.rb +35 -0
  69. data/lib/models/patient.rb +144 -0
  70. data/lib/models/pax_ap_serv.rb +30 -0
  71. data/lib/models/pax_note.rb +109 -0
  72. data/lib/models/personnel.rb +192 -0
  73. data/lib/models/place.rb +54 -0
  74. data/lib/models/planner.rb +57 -0
  75. data/lib/models/quote.rb +465 -0
  76. data/lib/models/quote_leg.rb +401 -0
  77. data/lib/models/report_define.rb +34 -0
  78. data/lib/models/report_filter.rb +56 -0
  79. data/lib/models/report_user.rb +54 -0
  80. data/lib/models/requirements_limit.rb +405 -0
  81. data/lib/models/sifl_table.rb +43 -0
  82. data/lib/models/sms.rb +106 -0
  83. data/lib/models/training_course.rb +34 -0
  84. data/lib/models/training_group.rb +21 -0
  85. data/lib/models/training_item.rb +102 -0
  86. data/lib/models/travel_request.rb +51 -0
  87. data/lib/models/trip.rb +342 -0
  88. data/lib/models/trip_leg.rb +1149 -0
  89. data/lib/models/trip_passenger.rb +188 -0
  90. data/lib/models/update.rb +38 -0
  91. data/lib/models/user_information.rb +248 -0
  92. data/lib/models/user_log.rb +23 -0
  93. data/lib/models/vendor.rb +93 -0
  94. data/lib/models/vendor_document.rb +97 -0
  95. data/lib/models/visa.rb +36 -0
  96. data/lib/sequel/code_group.rb +89 -0
  97. data/lib/sequel/fos_dates.rb +54 -0
  98. data/lib/sequel/metaprogramming.rb +8 -0
  99. data/lib/sequel/model_patch.rb +277 -0
  100. data/lib/sequel/pervasive_adapter.rb +214 -0
  101. data/lib/sequel/serializer/json_serializer.rb +129 -0
  102. data/lib/sequel/serializer/serializer.rb +94 -0
  103. data/lib/sequel/serializer/xml_serializer.rb +393 -0
  104. metadata +157 -0
@@ -0,0 +1,1149 @@
1
+ class TripLeg < Sequel::Model(:'trip legs')
2
+ # NOTE - Count of instances as of 06/01/2009 => 70630
3
+
4
+ # Many to one associations with atomic primary keys
5
+ many_to_one :aircraft, :class=>:Aircraft, :key=>:'aircraft id', :primary_key=>:'aircraft id'
6
+ many_to_one :aircraft_type, :class=>:AircraftType, :key=>:'aircraft type id', :primary_key=>:'aircraft type id'
7
+ many_to_one :locked_by, :class=>:User, :key=>:'locked by - user id', :primary_key=>:'users initials'
8
+ many_to_one :leg_rate_aircraft, :class=>:Aircraft, :key=>:'leg rate ac id', :primary_key=>:'aircraft id'
9
+ many_to_one :authorizer_name, :class=>:Personel, :key=>:authorization, :primary_key=>:employee_id
10
+
11
+ # Many to one associations with composite primary keys
12
+ n_to_o :trip, :class=>:Trip, :prefix=>'trips'
13
+ n_to_o :arrival_airport_fuel, :class => :AirportFuel, :prefix => 'arr fuel'
14
+ n_to_o :departure_airport_fuel, :class => :AirportFuel, :prefix => 'dep fuel'
15
+ n_to_o :crew_hotel, :class=>:AirportService, :prefix=>'crewhotel'
16
+ n_to_o :leg_authorizer, :class=>:Passenger, :prefix=>'author'
17
+ n_to_o :catering, :class=>:AirportService, :prefix=>'catering'
18
+ n_to_o :crew_limo, :class=>:AirportService, :prefix=>'crewlimo'
19
+ n_to_o :airport_fbo, :class=>:AirportFbo, :prefix=>'fbo'
20
+ n_to_o :fueler, :class=>:AirportFbo, :prefix=>'fueler'
21
+ n_to_o :leg_rate, :class=>:AircraftRate, :prefix=>'leg rate'
22
+ n_to_o :leg_requestor, :class=>:Passenger, :prefix=>'leg req'
23
+ n_to_o :pax_limo, :class=>:AirportService, :prefix=>'limo'
24
+ n_to_o :misc_service1, :class=>:AirportService, :prefix=>'misc 1'
25
+ n_to_o :misc_service2, :class=>:AirportService, :prefix=>'misc 2'
26
+ n_to_o :misc_service3, :class=>:AirportService, :prefix=>'misc 3'
27
+ n_to_o :pax_hotel, :class=>:AirportService, :prefix=>'pax hotel'
28
+ n_to_o :planner, :class=>:Passenger, :prefix=>'planner'
29
+ n_to_o :trip_requester, :class=>:Passenger, :prefix=>'requester'
30
+
31
+ # Many to one associations with custom treatment
32
+ many_to_one :arrival_airport, :class=>:Airport, :key=>nil, :dataset=>
33
+ proc {
34
+ if !arrival_icao.blank?
35
+ Airport.filter(:'icao'=> arrival_icao)
36
+ else
37
+ Airport.filter(:'airport id prefix'.like("%#{arrival_ap_prefix}"), :'airport id'.like("%#{arrival_airport_id}"))
38
+ end
39
+ }
40
+
41
+ many_to_one :departure_airport, :class=>:Airport, :key=>:departure_icao, :primary_key=>:icao #:key=>nil, :dataset=>proc{ ref_method = self[:'depart-icao/iata/id']; case ref_method; when 1 then Airport.filter(:'icao'=>self[:'departure icao']); when 2 then Airport.filter(:'iata'=>self[:'departure iata']); else Airport.filter(:'airport id prefix'.like("%#{self[:'depart a/p prefix']}"), :'airport id'.like("%#{self[:'depart airport id']}")); end }
42
+ many_to_one :alternate_arrival_airport, :class=>:Airport, :key=>nil, :dataset=>proc{ Airport.filter(:'airport id prefix'.like("%#{self[:'arr alt prefix']}"), :'airport id'.like( "%#{self[:'arr alt id']}"))}
43
+ many_to_one :alternate_departure_airport, :class=>:Airport, :key=>nil, :dataset=>proc{ Airport.filter(:'airport id prefix'.like("%#{self[:'dep alt prefix']}"), :'airport id'.like( "%#{self[:'dep alt id']}"))}
44
+
45
+ # One to many associations with composite primary keys
46
+ o_to_n :crew_legs, :class=>:CrewLeg, :prefix=>'trip leg'
47
+ o_to_n :audit_trails, :class=>:AuditTrail, :prefix=>'owner'
48
+ o_to_n :flight_log_expenses, :class=>:FlightLogExpense, :prefix=>'trip leg'
49
+
50
+ # Code associations
51
+ code_association :approval_value, :'approval code', :trip_approval
52
+ code_association :base, :'base', :location
53
+ code_association :cancellation_code, :'cancel code', :cancellation_code
54
+ code_association :company, :'company', :company
55
+ code_association :delay_1_reason_value, :'delay 1 reason', :delay_reason
56
+ code_association :delay_2_reason_value, :'delay 2 reason', :delay_reason
57
+ code_association :department, :'department', :department
58
+ code_association :division, :'division', :division
59
+ code_association :regulation_code, :'regulation', :certification
60
+ code_association :purpose, :'leg purpose code', :purpose
61
+ code_association :leg_rate_value, :'leg rate code', :aircraft_rate
62
+ code_association :leg_type_value, :'leg type code', :trip_type
63
+ code_association :trip_type, :'leg type code', :trip_type
64
+ code_association :special_qualification, :'specialqualification', :special_qualification
65
+
66
+ # Column alias overrides
67
+ column_view :dept_date_act_gmt, :date, :actual_departure_date_gmt
68
+ column_view :dept_time_act_gmt, :time, :actual_departure_time_gmt
69
+ column_def_datetime :actual_departure_date_time_gmt, :'dept date act gmt', :'dept time act gmt'
70
+
71
+ column_view :arrival_date_gmt, :date, :actual_arrival_date_gmt
72
+ column_view :arriv_time_act_gmt, :time, :actual_arrival_time_gmt
73
+ column_def_datetime :actual_arrival_date_time_gmt, :'arr date act gmt', :'arriv time act gmt'
74
+
75
+ column_view :dept_date_act_local, :date, :actual_departure_date_local
76
+ column_view :dept_time_act_local, :time, :actual_departure_time_local
77
+ column_def_datetime :actual_departure_date_time_local, :'dept date act local', :'dept time act local'
78
+
79
+ column_view :arrival_date_local, :date, :actual_arrival_date_local
80
+ column_view :arriv_time_act_local, :time, :actual_arrival_time_local
81
+ column_def_datetime :actual_arrival_date_time_local, :'arr date act local', :'arriv time act local'
82
+
83
+ column_view :dept_date_gmt, :date, :planned_departure_date_gmt
84
+ column_view :etd_gmt, :time, :planned_departure_time_gmt
85
+ column_def_datetime :planned_departure_date_time_gmt, :'dept date gmt', :'etd - gmt'
86
+
87
+ column_view :depart_date_local, :date, :planned_departure_date_local
88
+ column_view :etd_local, :time, :planned_departure_time_local
89
+ column_def_datetime :planned_departure_date_time_local, :'depart date - local', :'etd - local'
90
+
91
+ column_view :arrival_date_gmt, :date, :planned_arrival_date_gmt
92
+ column_view :eta_gmt, :time, :planned_arrival_time_gmt
93
+ column_def_datetime :planned_arrival_date_time_gmt, :'arrival date gmt', :'eta - gmt'
94
+
95
+ column_view :arrival_date_local, :date, :planned_arrival_date_local
96
+ column_view :eta_local, :time, :planned_arrival_time_local
97
+ column_def_datetime :planned_arrival_date_time_local, :'arrival date - local', :'eta - local'
98
+
99
+ column_view :dept_date_act_home, :date, :actual_departure_date_base
100
+ column_view :depart_time_act_home, :time, :actual_departure_time_base
101
+ column_def_datetime :actual_departure_date_time_base_old, :'dept date act home', :'depart time act home'
102
+ def actual_departure_date_time_base() actual_departure_date_time_gmt + (home_tz_gmt_offset*360); end
103
+
104
+ column_view :arr_date_act_home, :date, :actual_arrival_date_base
105
+ column_view :arrival_time_act_hom, :time, :actual_arrival_time_base
106
+ column_def_datetime :actual_arrival_date_time_base_old, :'arr date act home', :'arrival time act hom'
107
+ def actual_arrival_date_time_base() actual_arrival_date_time_gmt + (home_tz_gmt_offset*360); end
108
+
109
+ #Time Formatting Methods
110
+ column_view :ete, :time
111
+ column_view :eft, :time
112
+ column_view :flight_time_actual, :time, :aft_time
113
+ column_view :block_time_actual, :time, :abt_time
114
+ column_view :t_o_time_act_gmt, :time, :actual_takeoff_time_gmt
115
+ column_view :land_time_act_gmt, :time, :actual_land_time_gmt
116
+ column_view :delay_1_time, :time, :delay_1_duration
117
+ column_view :delay_2_time, :time, :delay_2_duration
118
+
119
+
120
+ delegate :tail_number, :to => :aircraft
121
+ delegate :max_pax, :to => :aircraft
122
+ delegate :name, :to => :airport_fbo, :prefix => true, :allow_nil => true
123
+ delegate :name, :to => :fueler, :prefix => true, :allow_nil => true
124
+ delegate :name, :to => :lead_passenger, :prefix => true, :allow_nil => true
125
+ delegate :name, :to => :trip_requester, :prefix => true, :allow_nil => true
126
+ delegate :lead_pax, :to => :trip
127
+ delegate :passenger_list, :to => :trip
128
+ delegate :name, :to => :lead_pax, :prefix => true, :allow_nil => true
129
+
130
+ # :'status' utility methods
131
+ @@Statuses = {
132
+ 'Scheduled Flight'=>0,
133
+ 'Leg Verified'=>1,
134
+ 'Cancelled'=>10,
135
+ 'Reserved'=>20,
136
+ 'Maintenance'=>21,
137
+ 'Available'=>22,
138
+ 'All Legs Cancelled'=>23,
139
+ 'Standby'=>24,
140
+ 'Note'=>31
141
+ }
142
+
143
+ def TripLeg.get_all_statuses
144
+ @@Statuses
145
+ end
146
+
147
+ def TripLeg.to_leg_status_values(names)
148
+ names.map{ |name| @@Statuses[name] }
149
+ end
150
+
151
+ def status_name
152
+ @@Statuses.index(self[:status])
153
+ end
154
+
155
+
156
+ #### BEGIN GENERATED SECTION ####
157
+ set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
158
+
159
+ column_alias :ac_cost_fixed, :'a/c cost fixed'
160
+ column_alias :ac_log_ac_hrs, :'a/c log a/c hrs'
161
+ column_alias :ac_log_acc_cyc_1, :'a/c log acc cyc 1'
162
+ column_alias :ac_log_acc_cyc_2, :'a/c log acc cyc 2'
163
+ column_alias :ac_log_acc_hrs_1, :'a/c log acc hrs 1'
164
+ column_alias :ac_log_acc_hrs_2, :'a/c log acc hrs 2'
165
+ column_alias :ac_log_eng_acc_cyc1, :'a/c log eng acc cyc1'
166
+ column_alias :ac_log_eng_acc_cyc2, :'a/c log eng acc cyc2'
167
+ column_alias :ac_log_eng_acc_cyc3, :'a/c log eng acc cyc3'
168
+ column_alias :ac_log_eng_acc_cyc4, :'a/c log eng acc cyc4'
169
+ column_alias :ac_log_eng_acc_hrs1, :'a/c log eng acc hrs1'
170
+ column_alias :ac_log_eng_acc_hrs2, :'a/c log eng acc hrs2'
171
+ column_alias :ac_log_eng_acc_hrs3, :'a/c log eng acc hrs3'
172
+ column_alias :ac_log_eng_acc_hrs4, :'a/c log eng acc hrs4'
173
+ column_alias :ac_log_eng_cyc_fix1, :'a/c log eng cyc fix1'
174
+ column_alias :ac_log_eng_cyc_fix2, :'a/c log eng cyc fix2'
175
+ column_alias :ac_log_eng_cyc_fix3, :'a/c log eng cyc fix3'
176
+ column_alias :ac_log_eng_cyc_fix4, :'a/c log eng cyc fix4'
177
+ column_alias :ac_log_eng_cycles_1, :'a/c log eng cycles 1'
178
+ column_alias :ac_log_eng_cycles_2, :'a/c log eng cycles 2'
179
+ column_alias :ac_log_eng_cycles_3, :'a/c log eng cycles 3'
180
+ column_alias :ac_log_eng_cycles_4, :'a/c log eng cycles 4'
181
+ column_alias :ac_log_eng_hrs_1, :'a/c log eng hrs 1'
182
+ column_alias :ac_log_eng_hrs_2, :'a/c log eng hrs 2'
183
+ column_alias :ac_log_eng_hrs_3, :'a/c log eng hrs 3'
184
+ column_alias :ac_log_eng_hrs_4, :'a/c log eng hrs 4'
185
+ column_alias :ac_log_eng_hrs_fix1, :'a/c log eng hrs fix1'
186
+ column_alias :ac_log_eng_hrs_fix2, :'a/c log eng hrs fix2'
187
+ column_alias :ac_log_eng_hrs_fix3, :'a/c log eng hrs fix3'
188
+ column_alias :ac_log_eng_hrs_fix4, :'a/c log eng hrs fix4'
189
+ column_alias :ac_log_eng_oil_1, :'a/c log eng oil 1'
190
+ column_alias :ac_log_eng_oil_2, :'a/c log eng oil 2'
191
+ column_alias :ac_log_eng_oil_3, :'a/c log eng oil 3'
192
+ column_alias :ac_log_eng_oil_4, :'a/c log eng oil 4'
193
+ column_alias :ac_log_eng_starts_1, :'a/c log eng starts 1'
194
+ column_alias :ac_log_eng_starts_2, :'a/c log eng starts 2'
195
+ column_alias :ac_log_eng_starts_3, :'a/c log eng starts 3'
196
+ column_alias :ac_log_eng_starts_4, :'a/c log eng starts 4'
197
+ column_alias :ac_log_eng_cp_1, :'a/c log eng cp 1'
198
+ column_alias :ac_log_eng_cp_2, :'a/c log eng cp 2'
199
+ column_alias :ac_log_eng_cp_3, :'a/c log eng cp 3'
200
+ column_alias :ac_log_eng_cp_4, :'a/c log eng cp 4'
201
+ column_alias :ac_log_eng_gp_1, :'a/c log eng gp 1'
202
+ column_alias :ac_log_eng_gp_2, :'a/c log eng gp 2'
203
+ column_alias :ac_log_eng_gp_3, :'a/c log eng gp 3'
204
+ column_alias :ac_log_eng_gp_4, :'a/c log eng gp 4'
205
+ column_alias :ac_log_eng_ip_1, :'a/c log eng ip 1'
206
+ column_alias :ac_log_eng_ip_2, :'a/c log eng ip 2'
207
+ column_alias :ac_log_eng_ip_3, :'a/c log eng ip 3'
208
+ column_alias :ac_log_eng_ip_4, :'a/c log eng ip 4'
209
+ column_alias :ac_log_eng_pt_1, :'a/c log eng pt 1'
210
+ column_alias :ac_log_eng_pt_2, :'a/c log eng pt 2'
211
+ column_alias :ac_log_eng_pt_3, :'a/c log eng pt 3'
212
+ column_alias :ac_log_eng_pt_4, :'a/c log eng pt 4'
213
+ column_alias :ac_log_leg_number, :'a/c log leg number'
214
+ column_alias :ac_log_lifts, :'a/c log lifts'
215
+ column_alias :ac_log_page_number, :'a/c log page number'
216
+ column_alias :ac_log_rev_deploy, :'a/c log rev deploy'
217
+ column_alias :ac_log_rev_eng_cyc, :'a/c log rev eng cyc'
218
+ column_alias :ac_rest_type, :'ac rest type'
219
+ column_alias :apis_num, :'apis num'
220
+ column_alias :ac_class_code, :'ac class code'
221
+ column_alias :actual_nautical_mile, :'actual nautical mile'
222
+ column_alias :additional_time, :'additional time'
223
+ column_alias :addl_nm_fixed, :'addl nm fixed'
224
+ column_alias :addl_nautical_miles, :'addl nautical miles'
225
+ column_alias :addl_time_fixed, :'addl time fixed'
226
+ column_alias :addon_cost, :'addon cost'
227
+ column_alias :air_chef, :'air chef'
228
+ column_alias :aircraft_cost, :'aircraft cost'
229
+ column_alias :aircraft_cruise, :'aircraft cruise'
230
+ column_alias :aircraft_id, :'aircraft id'
231
+ column_alias :aircraft_type_id, :'aircraft type id'
232
+ column_alias :airline_cost, :'airline cost'
233
+ column_alias :airline_cost_fixed, :'airline cost fixed'
234
+ column_alias :alert_flight, :'alert flight'
235
+ column_alias :altitude, :'altitude'
236
+ column_alias :altitude_fixed, :'altitude fixed'
237
+ column_alias :amend_date, :'amend date'
238
+ column_alias :amend_time, :'amend time'
239
+ column_alias :amended_by, :'amended by'
240
+ column_alias :approach_1_category, :'approach 1 category'
241
+ column_alias :approach_1_qty, :'approach 1 qty'
242
+ column_alias :approach_1_type, :'approach 1 type'
243
+ column_alias :approach_2_category, :'approach 2 category'
244
+ column_alias :approach_2_qty, :'approach 2 qty'
245
+ column_alias :approach_2_type, :'approach 2 type'
246
+ column_alias :approach_3_category, :'approach 3 category'
247
+ column_alias :approach_3_qty, :'approach 3 qty'
248
+ column_alias :approach_3_type, :'approach 3 type'
249
+ column_alias :approval_code, :'approval code'
250
+ column_alias :arr_alt_id, :'arr alt id'
251
+ column_alias :arr_alt_prefix, :'arr alt prefix'
252
+ column_alias :arr_alt_sch, :'arr alt sch'
253
+ column_alias :arr_ap_chg, :'arr ap chg'
254
+ column_alias :arr_date_act_gmt, :'arr date act gmt'
255
+ column_alias :arr_date_act_home, :'arr date act home'
256
+ column_alias :arr_date_act_local, :'arr date act local'
257
+ column_alias :arr_fuel_kid_comm, :'arr fuel kid - comm'
258
+ column_alias :arr_fuel_kid_date, :'arr fuel kid - date'
259
+ column_alias :arr_fuel_kid_mult, :'arr fuel kid - mult'
260
+ column_alias :arr_fuel_kid_time, :'arr fuel kid - time'
261
+ column_alias :arr_fuel_kid_user, :'arr fuel kid - user'
262
+ column_alias :arr_fuel_vendor, :'arr fuel vendor'
263
+ column_alias :arr_special_trn, :'arr special trn'
264
+ column_alias :arriv_tz_gmt_offset, :'arriv tz gmt offset'
265
+ column_alias :arriv_time_act_gmt, :'arriv time act gmt'
266
+ column_alias :arriv_time_act_local, :'arriv time act local'
267
+ column_alias :arrival, :'arrival'
268
+ column_alias :arrival_ap_prefix, :'arrival a/p prefix'
269
+ column_alias :arrival_aro, :'arrival aro'
270
+ column_alias :arrival_airport_id, :'arrival airport id'
271
+ column_alias :arrival_date_local, :'arrival date - local'
272
+ column_alias :arrival_date_gmt, :'arrival date gmt'
273
+ column_alias :arrival_date_home, :'arrival date home'
274
+ column_alias :arrival_iata, :'arrival iata'
275
+ column_alias :arrival_icao, :'arrival icao'
276
+ column_alias :arrival_non_ap_site, :'arrival non-ap site'
277
+ column_alias :arrival_site_desc, :'arrival site desc'
278
+ column_alias :arrival_time_act_hom, :'arrival time act hom'
279
+ column_alias :arrival_time_est, :'arrival time est.'
280
+ column_alias :arrival_icao_iata_id, :'arrival-icao/iata/id'
281
+ column_alias :aug_crew_count, :'aug crew count'
282
+ column_alias :author_kid_comm, :'author kid - comm'
283
+ column_alias :author_kid_date, :'author kid - date'
284
+ column_alias :author_kid_mult, :'author kid - mult'
285
+ column_alias :author_kid_time, :'author kid - time'
286
+ column_alias :author_kid_user, :'author kid - user'
287
+ column_alias :authorization, :'authorization'
288
+ column_alias :auto_validate, :'auto validate'
289
+ column_alias :base, :'base'
290
+ column_alias :billable, :'billable'
291
+ column_alias :billable_expenses, :'billable expenses'
292
+ column_alias :block_time_actual, :'block time actual'
293
+ column_alias :breakfast_comment, :'breakfast comment'
294
+ column_alias :cg, :'cg'
295
+ column_alias :cg_limit_aft, :'cg limit aft'
296
+ column_alias :cg_limit_fwd, :'cg limit fwd'
297
+ column_alias :cancel_code, :'cancel code'
298
+ column_alias :cancelled, :'cancelled'
299
+ column_alias :cargo_pounds, :'cargo - pounds'
300
+ column_alias :cargo_actual, :'cargo actual'
301
+ column_alias :cargo_off_at_arrival, :'cargo off at arrival'
302
+ column_alias :cargo_on_at_depart, :'cargo on at depart'
303
+ column_alias :category_2_appr, :'category 2 appr'
304
+ column_alias :catering_comment, :'catering comment'
305
+ column_alias :catering_departure, :'catering departure'
306
+ column_alias :catering_flags, :'catering flags'
307
+ column_alias :catering_kid_comm, :'catering kid - comm'
308
+ column_alias :catering_kid_date, :'catering kid - date'
309
+ column_alias :catering_kid_mult, :'catering kid - mult'
310
+ column_alias :catering_kid_time, :'catering kid - time'
311
+ column_alias :catering_kid_user, :'catering kid - user'
312
+ column_alias :closed, :'closed'
313
+ column_alias :company, :'company'
314
+ column_alias :cost_center, :'cost center'
315
+ column_alias :crew_brief, :'crew brief'
316
+ column_alias :crew_change, :'crew change'
317
+ column_alias :crew_duty, :'crew duty'
318
+ column_alias :crew_flight, :'crew flight'
319
+ column_alias :crew_hotel_comment, :'crew hotel comment'
320
+ column_alias :crew_hotel_departure, :'crew hotel departure'
321
+ column_alias :crew_hotel_flags, :'crew hotel flags'
322
+ column_alias :crew_pic_chg, :'crew pic chg'
323
+ column_alias :crew_rest, :'crew rest'
324
+ column_alias :crew_training_count, :'crew training count'
325
+ column_alias :crewhotel_kid_comm, :'crewhotel kid - comm'
326
+ column_alias :crewhotel_kid_date, :'crewhotel kid - date'
327
+ column_alias :crewhotel_kid_mult, :'crewhotel kid - mult'
328
+ column_alias :crewhotel_kid_time, :'crewhotel kid - time'
329
+ column_alias :crewhotel_kid_user, :'crewhotel kid - user'
330
+ column_alias :crewlimo_comment, :'crewlimo comment'
331
+ column_alias :crewlimo_depart, :'crewlimo depart'
332
+ column_alias :crewlimo_flags, :'crewlimo flags'
333
+ column_alias :crewlimo_kid_comm, :'crewlimo kid - comm'
334
+ column_alias :crewlimo_kid_date, :'crewlimo kid - date'
335
+ column_alias :crewlimo_kid_mult, :'crewlimo kid - mult'
336
+ column_alias :crewlimo_kid_time, :'crewlimo kid - time'
337
+ column_alias :crewlimo_kid_user, :'crewlimo kid - user'
338
+ column_alias :dh_confirmed, :'dh confirmed'
339
+ column_alias :dh_cost, :'dh cost'
340
+ column_alias :dh_currency, :'dh currency'
341
+ column_alias :dh_date_begin, :'dh date begin'
342
+ column_alias :dh_date_end, :'dh date end'
343
+ column_alias :dh_flex_begin, :'dh flex begin'
344
+ column_alias :dh_flex_end, :'dh flex end'
345
+ column_alias :dh_flex_times, :'dh flex times'
346
+ column_alias :dh_pax_count, :'dh pax count'
347
+ column_alias :dh_pax_ent, :'dh pax ent'
348
+ column_alias :dh_pax_personal, :'dh pax personal'
349
+ column_alias :day1_reserve_leg, :'day1 reserve leg'
350
+ column_alias :deadhead, :'deadhead'
351
+ column_alias :deiced, :'deiced'
352
+ column_alias :delay_1_reason, :'delay 1 reason'
353
+ column_alias :delay_1_time, :'delay 1 time'
354
+ column_alias :delay_2_reason, :'delay 2 reason'
355
+ column_alias :delay_2_time, :'delay 2 time'
356
+ column_alias :delay_3_reason, :'delay 3 reason'
357
+ column_alias :delay_3_time, :'delay 3 time'
358
+ column_alias :delay_4_reason, :'delay 4 reason'
359
+ column_alias :delay_4_time, :'delay 4 time'
360
+ column_alias :delay_comment, :'delay comment'
361
+ column_alias :delivery_comment, :'delivery comment'
362
+ column_alias :dep_alt_id, :'dep alt id'
363
+ column_alias :dep_alt_prefix, :'dep alt prefix'
364
+ column_alias :dep_alt_sch, :'dep alt sch'
365
+ column_alias :dep_ap_chg, :'dep ap chg'
366
+ column_alias :dep_fuel_kid_comm, :'dep fuel kid - comm'
367
+ column_alias :dep_fuel_kid_date, :'dep fuel kid - date'
368
+ column_alias :dep_fuel_kid_mult, :'dep fuel kid - mult'
369
+ column_alias :dep_fuel_kid_time, :'dep fuel kid - time'
370
+ column_alias :dep_fuel_kid_user, :'dep fuel kid - user'
371
+ column_alias :dep_fuel_vendor, :'dep fuel vendor'
372
+ column_alias :dep_special_trn, :'dep special trn'
373
+ column_alias :depart_ap_prefix, :'depart a/p prefix'
374
+ column_alias :depart_airport_id, :'depart airport id'
375
+ column_alias :depart_date_local, :'depart date - local'
376
+ column_alias :depart_date_key, :'depart date key'
377
+ column_alias :depart_non_ap_site, :'depart non-ap site'
378
+ column_alias :depart_site_desc, :'depart site desc'
379
+ column_alias :depart_tz_gmt_offset, :'depart tz gmt offset'
380
+ column_alias :depart_time_act_home, :'depart time act home'
381
+ column_alias :depart_icao_iata_id, :'depart-icao/iata/id'
382
+ column_alias :department, :'department'
383
+ column_alias :departure_aro, :'departure aro'
384
+ column_alias :departure_iata, :'departure iata'
385
+ column_alias :departure_icao, :'departure icao'
386
+ column_alias :dept_date_act_gmt, :'dept date act gmt'
387
+ column_alias :dept_date_act_home, :'dept date act home'
388
+ column_alias :dept_date_act_local, :'dept date act local'
389
+ column_alias :dept_date_gmt, :'dept date gmt'
390
+ column_alias :dept_date_home, :'dept date home'
391
+ column_alias :dept_time_act_gmt, :'dept time act gmt'
392
+ column_alias :dept_time_act_local, :'dept time act local'
393
+ column_alias :dept_time_est, :'dept time est.'
394
+ column_alias :dinner_comment, :'dinner comment'
395
+ column_alias :division, :'division'
396
+ column_alias :duty_act, :'duty act'
397
+ column_alias :duty_post_flight, :'duty post flight'
398
+ column_alias :duty_pre_flight, :'duty pre flight'
399
+ column_alias :eft, :'eft'
400
+ column_alias :eft_fixed, :'eft fixed'
401
+ column_alias :egt, :'egt'
402
+ column_alias :egt_fixed, :'egt fixed'
403
+ column_alias :eta_gmt, :'eta - gmt'
404
+ column_alias :eta_home, :'eta - home'
405
+ column_alias :eta_local, :'eta - local'
406
+ column_alias :eta_fixed, :'eta fixed'
407
+ column_alias :eta_night, :'eta night'
408
+ column_alias :eta_requested, :'eta requested'
409
+ column_alias :eta_tentative, :'eta tentative'
410
+ column_alias :etd_gmt, :'etd - gmt'
411
+ column_alias :etd_home, :'etd - home'
412
+ column_alias :etd_local, :'etd - local'
413
+ column_alias :etd_fixed, :'etd fixed'
414
+ column_alias :etd_key, :'etd key'
415
+ column_alias :etd_night, :'etd night'
416
+ column_alias :etd_requested, :'etd requested'
417
+ column_alias :etd_tentative, :'etd tentative'
418
+ column_alias :ete, :'ete'
419
+ column_alias :email, :'email'
420
+ column_alias :exp_res_leg, :'exp res leg'
421
+ column_alias :ext_trip_num, :'ext trip num'
422
+ column_alias :fbo_comment, :'fbo comment'
423
+ column_alias :fbo_departure, :'fbo departure'
424
+ column_alias :fbo_flags, :'fbo flags'
425
+ column_alias :fbo_kid_comm, :'fbo kid - comm'
426
+ column_alias :fbo_kid_date, :'fbo kid - date'
427
+ column_alias :fbo_kid_mult, :'fbo kid - mult'
428
+ column_alias :fbo_kid_time, :'fbo kid - time'
429
+ column_alias :fbo_kid_user, :'fbo kid - user'
430
+ column_alias :fs_apis, :'fs apis'
431
+ column_alias :fs_aro_dom_slot, :'fs aro dom slot'
432
+ column_alias :fs_ac_parking, :'fs ac parking'
433
+ column_alias :fs_ac_security, :'fs ac security'
434
+ column_alias :fs_aircraft_charter, :'fs aircraft charter'
435
+ column_alias :fs_attachments, :'fs attachments'
436
+ column_alias :fs_bill_cc, :'fs bill cc'
437
+ column_alias :fs_bill_direct, :'fs bill direct'
438
+ column_alias :fs_catering, :'fs catering'
439
+ column_alias :fs_cost_est, :'fs cost est'
440
+ column_alias :fs_crew_hotel, :'fs crew hotel'
441
+ column_alias :fs_crew_limo, :'fs crew limo'
442
+ column_alias :fs_crew_visa, :'fs crew visa'
443
+ column_alias :fs_customs, :'fs customs'
444
+ column_alias :fs_flight_following, :'fs flight following'
445
+ column_alias :fs_flight_plan_cond, :'fs flight plan cond'
446
+ column_alias :fs_flight_planning, :'fs flight planning'
447
+ column_alias :fs_flt_plan_wind, :'fs flt plan wind'
448
+ column_alias :fs_fueler, :'fs fueler'
449
+ column_alias :fs_gnd_handling, :'fs gnd handling'
450
+ column_alias :fs_hangar, :'fs hangar'
451
+ column_alias :fs_hotel, :'fs hotel'
452
+ column_alias :fs_landing_permit, :'fs landing permit'
453
+ column_alias :fs_lavatory, :'fs lavatory'
454
+ column_alias :fs_meet_greet, :'fs meet greet'
455
+ column_alias :fs_misc, :'fs misc'
456
+ column_alias :fs_overflight_permit, :'fs overflight permit'
457
+ column_alias :fs_pax_dep_loc, :'fs pax dep loc'
458
+ column_alias :fs_prefile, :'fs prefile'
459
+ column_alias :fs_prelim_flt_plan, :'fs prelim flt plan'
460
+ column_alias :fs_quick_turn, :'fs quick turn'
461
+ column_alias :fs_security_guard, :'fs security guard'
462
+ column_alias :fs_slots, :'fs slots'
463
+ column_alias :fs_transportation, :'fs transportation'
464
+ column_alias :fs_update_req, :'fs update req'
465
+ column_alias :fs_uplink_afis, :'fs uplink afis'
466
+ column_alias :fs_uplink_uvdata, :'fs uplink uvdata'
467
+ column_alias :fs_visa, :'fs visa'
468
+ column_alias :fs_weather_brief, :'fs weather brief'
469
+ column_alias :fs_weather_outlook, :'fs weather outlook'
470
+ column_alias :fs_weather_update, :'fs weather update'
471
+ column_alias :fs_wx_brief_intl, :'fs wx brief intl'
472
+ column_alias :fs2, :'fs2'
473
+ column_alias :flight_id, :'flight id'
474
+ column_alias :flight_number, :'flight number'
475
+ column_alias :flight_time_actual, :'flight time actual'
476
+ column_alias :flight_time_inst_act, :'flight time inst act'
477
+ column_alias :flight_time_inst_sim, :'flight time inst sim'
478
+ column_alias :flight_time_night, :'flight time night'
479
+ column_alias :flight_time_training, :'flight time training'
480
+ column_alias :flog_regulation, :'flog regulation'
481
+ column_alias :flt_follow, :'flt follow'
482
+ column_alias :flt_time_tax, :'flt time tax'
483
+ column_alias :fuel_burn, :'fuel burn'
484
+ column_alias :fuel_burned, :'fuel burned'
485
+ column_alias :fuel_code, :'fuel code'
486
+ column_alias :fuel_cost, :'fuel cost'
487
+ column_alias :fuel_in, :'fuel in'
488
+ column_alias :fuel_out, :'fuel out'
489
+ column_alias :fuel_stop_time, :'fuel stop time'
490
+ column_alias :fueler_comment, :'fueler comment'
491
+ column_alias :fueler_depart, :'fueler depart'
492
+ column_alias :fueler_flags, :'fueler flags'
493
+ column_alias :fueler_kid_comm, :'fueler kid - comm'
494
+ column_alias :fueler_kid_date, :'fueler kid - date'
495
+ column_alias :fueler_kid_mult, :'fueler kid - mult'
496
+ column_alias :fueler_kid_time, :'fueler kid - time'
497
+ column_alias :fueler_kid_user, :'fueler kid - user'
498
+ column_alias :glndw, :'glndw'
499
+ column_alias :gtow, :'gtow'
500
+ column_alias :group, :'group'
501
+ column_alias :heading, :'heading'
502
+ column_alias :hobbs_begin_time, :'hobbs begin time'
503
+ column_alias :hobbs_end, :'hobbs end'
504
+ column_alias :holding, :'holding'
505
+ column_alias :home_tz_gmt_offset, :'home tz gmt offset'
506
+ column_alias :inside_eec_percent, :'inside eec percent'
507
+ column_alias :inst_appr_ap1_id, :'inst appr ap1 id'
508
+ column_alias :inst_appr_ap1_prefix, :'inst appr ap1 prefix'
509
+ column_alias :inst_appr_ap2_id, :'inst appr ap2 id'
510
+ column_alias :inst_appr_ap2_prefix, :'inst appr ap2 prefix'
511
+ column_alias :inst_appr_ap3_id, :'inst appr ap3 id'
512
+ column_alias :inst_appr_ap3_prefix, :'inst appr ap3 prefix'
513
+ column_alias :internal_12, :'internal 12'
514
+ column_alias :internal_13, :'internal 13'
515
+ column_alias :internal_calc_error, :'internal calc error'
516
+ column_alias :internal_trans_crew, :'internal trans crew'
517
+ column_alias :internal02, :'internal02'
518
+ column_alias :internal03, :'internal03'
519
+ column_alias :internal04, :'internal04'
520
+ column_alias :international_leg, :'international leg'
521
+ column_alias :kid_comm, :'kid - comm'
522
+ column_alias :kid_date, :'kid - date'
523
+ column_alias :kid_mult, :'kid - mult'
524
+ column_alias :kid_time, :'kid - time'
525
+ column_alias :kid_user, :'kid - user'
526
+ column_alias :land_time_act_gmt, :'land time act gmt'
527
+ column_alias :land_time_act_home, :'land time act home'
528
+ column_alias :landing_night, :'landing night'
529
+ column_alias :landing_qty, :'landing qty'
530
+ column_alias :landing_seo, :'landing seo'
531
+ column_alias :landing_time_est, :'landing time est.'
532
+ column_alias :leg_count, :'leg count'
533
+ column_alias :leg_error, :'leg error'
534
+ column_alias :leg_language, :'leg language'
535
+ column_alias :leg_no_tax, :'leg no tax'
536
+ column_alias :leg_number, :'leg number'
537
+ column_alias :leg_pairing_end, :'leg pairing end'
538
+ column_alias :leg_pax_comment, :'leg pax comment'
539
+ column_alias :leg_purpose_code, :'leg purpose code'
540
+ column_alias :leg_rate_ac_company, :'leg rate ac company'
541
+ column_alias :leg_rate_ac_id, :'leg rate ac id'
542
+ column_alias :leg_rate_code, :'leg rate code'
543
+ column_alias :leg_rate_date, :'leg rate date'
544
+ column_alias :leg_rate_kid_comm, :'leg rate kid - comm'
545
+ column_alias :leg_rate_kid_date, :'leg rate kid - date'
546
+ column_alias :leg_rate_kid_mult, :'leg rate kid - mult'
547
+ column_alias :leg_rate_kid_time, :'leg rate kid - time'
548
+ column_alias :leg_rate_kid_user, :'leg rate kid - user'
549
+ column_alias :leg_req_kid_comm, :'leg req kid - comm'
550
+ column_alias :leg_req_kid_date, :'leg req kid - date'
551
+ column_alias :leg_req_kid_mult, :'leg req kid - mult'
552
+ column_alias :leg_req_kid_time, :'leg req kid - time'
553
+ column_alias :leg_req_kid_user, :'leg req kid - user'
554
+ column_alias :leg_requester, :'leg requester'
555
+ column_alias :leg_state, :'leg state'
556
+ column_alias :leg_type_code, :'leg type code'
557
+ column_alias :legality_violation, :'legality violation'
558
+ column_alias :limo_comment, :'limo comment'
559
+ column_alias :limo_departure, :'limo departure'
560
+ column_alias :limo_flags, :'limo flags'
561
+ column_alias :limo_kid_comm, :'limo kid - comm'
562
+ column_alias :limo_kid_date, :'limo kid - date'
563
+ column_alias :limo_kid_mult, :'limo kid - mult'
564
+ column_alias :limo_kid_time, :'limo kid - time'
565
+ column_alias :limo_kid_user, :'limo kid - user'
566
+ column_alias :locked, :'locked'
567
+ column_alias :locked_by_user_id, :'locked by - user id'
568
+ column_alias :lunch_comment, :'lunch comment'
569
+ column_alias :mtow, :'mtow'
570
+ column_alias :mics_serv_2_comment, :'mics serv 2 comment'
571
+ column_alias :misc_1_kid_comm, :'misc 1 kid - comm'
572
+ column_alias :misc_1_kid_date, :'misc 1 kid - date'
573
+ column_alias :misc_1_kid_mult, :'misc 1 kid - mult'
574
+ column_alias :misc_1_kid_time, :'misc 1 kid - time'
575
+ column_alias :misc_1_kid_user, :'misc 1 kid - user'
576
+ column_alias :misc_2_kid_comm, :'misc 2 kid - comm'
577
+ column_alias :misc_2_kid_date, :'misc 2 kid - date'
578
+ column_alias :misc_2_kid_mult, :'misc 2 kid - mult'
579
+ column_alias :misc_2_kid_time, :'misc 2 kid - time'
580
+ column_alias :misc_2_kid_user, :'misc 2 kid - user'
581
+ column_alias :misc_3_kid_comm, :'misc 3 kid - comm'
582
+ column_alias :misc_3_kid_date, :'misc 3 kid - date'
583
+ column_alias :misc_3_kid_mult, :'misc 3 kid - mult'
584
+ column_alias :misc_3_kid_time, :'misc 3 kid - time'
585
+ column_alias :misc_3_kid_user, :'misc 3 kid - user'
586
+ column_alias :misc_serv_1_comment, :'misc serv 1 comment'
587
+ column_alias :misc_serv_1_depart, :'misc serv 1 depart'
588
+ column_alias :misc_serv_1_flags, :'misc serv 1 flags'
589
+ column_alias :misc_serv_2_depart, :'misc serv 2 depart'
590
+ column_alias :misc_serv_2_flags, :'misc serv 2 flags'
591
+ column_alias :misc_serv_3_comment, :'misc serv 3 comment'
592
+ column_alias :misc_serv_3_depart, :'misc serv 3 depart'
593
+ column_alias :misc_serv_3_flags, :'misc serv 3 flags'
594
+ column_alias :nautical_miles, :'nautical miles'
595
+ column_alias :never_scheduled, :'never scheduled'
596
+ column_alias :night_flight, :'night flight'
597
+ column_alias :non_fuel_expenses, :'non fuel expenses'
598
+ column_alias :note, :'note'
599
+ column_alias :number_of_fuel_stops, :'number of fuel stops'
600
+ column_alias :open_checklist, :'open checklist'
601
+ column_alias :overflight, :'overflight'
602
+ column_alias :pic_rcp, :'pic rcp'
603
+ column_alias :pager, :'pager'
604
+ column_alias :pallets, :'pallets'
605
+ column_alias :pass_actual_fixed, :'pass actual fixed'
606
+ column_alias :passengers_actual, :'passengers actual'
607
+ column_alias :pax_boarding, :'pax boarding'
608
+ column_alias :pax_count, :'pax count'
609
+ column_alias :pax_deplaning, :'pax deplaning'
610
+ column_alias :pax_ent, :'pax ent'
611
+ column_alias :pax_estimated, :'pax estimated'
612
+ column_alias :pax_hotel_comment, :'pax hotel comment'
613
+ column_alias :pax_hotel_departure, :'pax hotel departure'
614
+ column_alias :pax_hotel_flags, :'pax hotel flags'
615
+ column_alias :pax_hotel_kid_comm, :'pax hotel kid - comm'
616
+ column_alias :pax_hotel_kid_date, :'pax hotel kid - date'
617
+ column_alias :pax_hotel_kid_mult, :'pax hotel kid - mult'
618
+ column_alias :pax_hotel_kid_time, :'pax hotel kid - time'
619
+ column_alias :pax_hotel_kid_user, :'pax hotel kid - user'
620
+ column_alias :pax_personal, :'pax personal'
621
+ column_alias :pax_standby_count, :'pax standby count'
622
+ column_alias :pax_waitlist, :'pax waitlist'
623
+ column_alias :pilot_mon_appr, :'pilot mon appr'
624
+ column_alias :planner, :'planner'
625
+ column_alias :planner_fax, :'planner fax'
626
+ column_alias :planner_kid_comm, :'planner kid - comm'
627
+ column_alias :planner_kid_date, :'planner kid - date'
628
+ column_alias :planner_kid_mult, :'planner kid - mult'
629
+ column_alias :planner_kid_time, :'planner kid - time'
630
+ column_alias :planner_kid_user, :'planner kid - user'
631
+ column_alias :planner_phone, :'planner phone'
632
+ column_alias :priority, :'priority'
633
+ column_alias :quote_rate, :'quote rate'
634
+ column_alias :ron, :'ron'
635
+ column_alias :ron_fixed, :'ron fixed'
636
+ column_alias :radiation, :'radiation'
637
+ column_alias :regulation, :'regulation'
638
+ column_alias :release_date, :'release date'
639
+ column_alias :release_time, :'release time'
640
+ column_alias :release_user, :'release user'
641
+ column_alias :released, :'released'
642
+ column_alias :requester, :'requester'
643
+ column_alias :requester_kid_comm, :'requester kid - comm'
644
+ column_alias :requester_kid_date, :'requester kid - date'
645
+ column_alias :requester_kid_mult, :'requester kid - mult'
646
+ column_alias :requester_kid_time, :'requester kid - time'
647
+ column_alias :requester_kid_user, :'requester kid - user'
648
+ column_alias :requester_name_key, :'requester name key'
649
+ column_alias :requester_purpose, :'requester purpose'
650
+ column_alias :restricted, :'restricted'
651
+ column_alias :route_comment, :'route comment'
652
+ column_alias :ss_start_lat, :'ss start lat'
653
+ column_alias :ss_start_long, :'ss start long'
654
+ column_alias :ss_start_time, :'ss start time'
655
+ column_alias :ss_stop_lat, :'ss stop lat'
656
+ column_alias :ss_stop_long, :'ss stop long'
657
+ column_alias :ss_stop_time, :'ss stop time'
658
+ column_alias :scheduled_quote, :'scheduled quote'
659
+ column_alias :security_code, :'security code'
660
+ column_alias :shuttle_flight, :'shuttle flight'
661
+ column_alias :simulator, :'simulator'
662
+ column_alias :sortie, :'sortie'
663
+ column_alias :special_comment, :'special comment'
664
+ column_alias :specialqualification, :'specialqualification'
665
+ column_alias :status, :'status'
666
+ column_alias :statute_miles, :'statute miles'
667
+ column_alias :sup_res_leg, :'sup res leg'
668
+ column_alias :t_o_time_act_gmt, :'t/o time act gmt'
669
+ column_alias :tas, :'tas'
670
+ column_alias :tas_fixed, :'tas fixed'
671
+ column_alias :tach_begin_time, :'tach begin time'
672
+ column_alias :tach_end_time, :'tach end time'
673
+ column_alias :takeof_time_act_home, :'takeof time act home'
674
+ column_alias :takeoff_night, :'takeoff night'
675
+ column_alias :takeoff_qty, :'takeoff qty'
676
+ column_alias :takeoff_seo, :'takeoff seo'
677
+ column_alias :taxi_fixed, :'taxi fixed'
678
+ column_alias :taxi_time, :'taxi time'
679
+ column_alias :tech_stop, :'tech stop'
680
+ column_alias :time_zone_change, :'time zone change'
681
+ column_alias :total_expenses, :'total expenses'
682
+ column_alias :total_weight, :'total weight'
683
+ column_alias :touch_go, :'touch go'
684
+ column_alias :tracking, :'tracking'
685
+ column_alias :trans_crew_fa, :'trans crew fa'
686
+ column_alias :trans_crew_fe, :'trans crew fe'
687
+ column_alias :trans_crew_other, :'trans crew other'
688
+ column_alias :trans_crew_pic, :'trans crew pic'
689
+ column_alias :trans_crew_sic, :'trans crew sic'
690
+ column_alias :trip_number, :'trip number'
691
+ column_alias :trip_request, :'trip request'
692
+ column_alias :trips_kid_comm, :'trips kid - comm'
693
+ column_alias :trips_kid_date, :'trips kid - date'
694
+ column_alias :trips_kid_mult, :'trips kid - mult'
695
+ column_alias :trips_kid_time, :'trips kid - time'
696
+ column_alias :trips_kid_user, :'trips kid - user'
697
+ column_alias :vor_check, :'vor check'
698
+ column_alias :valid_rest, :'valid rest'
699
+ column_alias :verified_by, :'verified by'
700
+ column_alias :verify_date, :'verify date'
701
+ column_alias :verify_number, :'verify number'
702
+ column_alias :verify_time, :'verify time'
703
+ column_alias :wind, :'wind'
704
+ column_alias :winds_fixed, :'winds fixed'
705
+ column_alias :key0, :'key0'
706
+ column_alias :key1, :'key1'
707
+ column_alias :key2, :'key2'
708
+ column_alias :key3, :'key3'
709
+ column_alias :key4, :'key4'
710
+ column_alias :key5, :'key5'
711
+ column_alias :key6, :'key6'
712
+ column_alias :key7, :'key7'
713
+ column_alias :key8, :'key8'
714
+ #### END GENERATED SECTION ####
715
+
716
+
717
+ def client_name
718
+ theStatus = trip_status
719
+ !(theStatus=='MAINT' || theStatus=='RESVD') ? requester : ''
720
+ end
721
+
722
+ def ebt_time
723
+ theStatus = trip_status
724
+ if theStatus='SCHED' || theStatus='VERI' || (arrival_ap_prefix != departure_ap_prefix)
725
+ minutes_between = (planned_arrival_date_time_gmt - planned_departure_date_time_gmt)/60;
726
+ return Time.from_fos_time(minutes_between)
727
+ end
728
+ Time.from_fos_time(0)
729
+ end
730
+
731
+ # get pic or sic or purser for this trip leg. type should be :pic or :sic or :pur
732
+ def pilot_code(type)
733
+ return '' unless type
734
+ cl = crew_legs.find{|cl| cl.position_code_code == type.to_s.upcase }
735
+ return cl ? cl.crew : ''
736
+ end
737
+ def pic; pilot_code(:pic); end
738
+ def sic; pilot_code(:sic); end
739
+
740
+
741
+ ##### for the web service TripLegsByDate #######
742
+ column_view :closed, :boolean
743
+ column_view :cancelled, :boolean
744
+ column_view :never_scheduled, :boolean
745
+ column_view :trip_request, :boolean
746
+ column_view :is_deadhead?, :boolean
747
+
748
+ def status_code
749
+ return "Cancelled" if cancel_code != 0
750
+ case status
751
+ when 0 then "Scheduled"
752
+ when 1 then "Leg Verified"
753
+ when 10 then "Cancelled"
754
+ when 23 then "All Legs Cancelled"
755
+ when 21 then "Maintenance"
756
+ when 20 then "Reserved"
757
+ else "[#{status}]"
758
+ end
759
+ end
760
+
761
+ TRIP_LEGS_FIELD_MAP =
762
+ {
763
+ 'status_code' => 'TripLegStatus',
764
+ 'leg_number' => 'leg',
765
+ 'trip_requester_name' => 'Requester',
766
+ 'requester_name_key' => 'reqnamekey',
767
+ 'aircraft_id' => 'AircraftID',
768
+ 'leg_count' => 'LegCount',
769
+ 'departure_icao' => 'DepartICAO',
770
+ 'arrival_icao' => 'ArrivalICAO',
771
+ 'planned_departure_date_gmt_view_mdy_ipc' => 'DepartDateZulu',
772
+ 'planned_arrival_date_gmt_view_mdy_ipc' => 'ArriveDateZulu',
773
+ 'planned_departure_date_local_view_mdy_ipc' => 'DepartDateLocal',
774
+ 'planned_arrival_date_local_view_mdy_ipc' => 'ArriveDateLocal',
775
+ 'planned_departure_time_gmt_view' => 'DepartTimeZulu',
776
+ 'planned_arrival_time_gmt_view' => 'ArriveTimeZulu',
777
+ 'planned_departure_time_local_view' => 'DepartTimeLocal',
778
+ 'planned_arrival_time_local_view' => 'ArriveTimeLocal',
779
+ 'pax_count' => 'PaxCount',
780
+ 'is_deadhead?_boolean_view' => 'Deadhead',
781
+ 'status' => 'Status',
782
+ 'closed_boolean_view' => 'Closed',
783
+ 'cancelled_boolean_view' => 'Cancelled',
784
+ 'cancel_code' => 'CancelCode',
785
+ 'never_scheduled_boolean_view' => 'NeverScheduled',
786
+ 'trip_request_boolean_view' => 'TripRequest',
787
+ 'trip_number' => 'TripNumber',
788
+ 'tail_number' => 'TailNumber',
789
+ 'aircraft_type_id' => 'AircraftType',
790
+ 'fueler_name' => 'DEPFBOName',
791
+ 'airport_fbo_name' => 'ARRFBOName',
792
+ 'pic' => 'CrewPIC',
793
+ 'sic' => 'CrewSIC',
794
+ 'lead_pax_name' => 'LeadPax'
795
+ }
796
+
797
+
798
+ TRIP_LEGS_FIELD_MAP.each{|k,v| alias_method v, k }
799
+ ##### END for web service TripLegsByDate #######
800
+
801
+ subset(:live_departures, :'trip legs__status'=>[0,1], :'trip legs__cancel_code'=>0, ~:leg_type_code=>[7, 103, 113])
802
+ subset(:maintenance_legs, :status=>21, :leg_type_code=>7 )
803
+
804
+ def self.trip_legs_by_date_range(from_date, to_date)
805
+ unless @trip_legs_by_date_ps
806
+ ds = TripLeg.
807
+ filter( :depart_date_key >= :$from_date).filter( :depart_date_key <= :$to_date ).
808
+ filter( ~:'trip legs__status'=> 31 ). # exclude comments which have status 31
809
+ eager_graph(:crew_legs => :position_code).eager_graph(:aircraft, :fueler, :airport_fbo, :trip_requester, :trip).
810
+ select_fields(
811
+ :self => [:trip_number, :leg_number, :arrival_icao, :departure_icao, :depart_ap_prefix,
812
+ :arrival_icao_iata_id, :arrival_icao, :arrival_iata, :arrival_ap_prefix, :arrival_airport_id,
813
+ :time_zone_change, :dept_date_gmt, :arrival_date_gmt, :depart_date_local,
814
+ :arrival_date_local, :ete, :etd_local, :eta_local, :etd_gmt, :eta_gmt,
815
+ :passengers_actual, :pax_count, :leg_count, :requester, :requester_name_key,
816
+ :aircraft_type_id, :leg_type_code, :trip_request, :fuel_burned, :deadhead,
817
+ :status, :closed, :cancelled, :cancel_code, :never_scheduled],
818
+ :crew_legs => [:crew, :position],
819
+ :crew_legs__position_code => [:code],
820
+ :aircraft => [:max_pax, :tail_number, :aircraft_id],
821
+ :fueler => [:name],
822
+ :airport_fbo => [:name],
823
+ :trip_requester => [:name],
824
+ :trip => [:approval_code]).
825
+ order(:'trip legs__trip_number',:'trip legs__leg_number')
826
+ @trip_legs_by_date_ps = ds.prepare(:select, :trip_legs_by_date_ps)
827
+ end
828
+ @trip_legs_by_date_ps.call(:from_date=> from_date.to_fos_days, :to_date => to_date.to_fos_days)
829
+ end
830
+
831
+ def pic_val; pic.blank? ? "N/A" : pic; end
832
+ def sic_val; sic.blank? ? "N/A" : sic; end
833
+
834
+ CRES_LIVE_DEPARTURES_FIELDS = [
835
+ :trip_number, :leg_number, :arrival_icao, :departure_icao, :time_zone_change,
836
+ :pax_count, :passengers_actual, :tail_number, :max_pax,
837
+ :pic_val, :sic_val, :requester, :ete_time_view,
838
+ :actual_departure_date_gmt, :planned_arrival_date_gmt,
839
+ :planned_departure_time_local_view, :planned_arrival_time_local_view
840
+ ]
841
+
842
+ IROPS_LIVE_DEPARTURES_FIELDS = CRES_LIVE_DEPARTURES_FIELDS.dup << :lead_pax_name
843
+
844
+ def self.live_departures_by_date_range(from_date, to_date)
845
+ unless @live_departures_by_date_ps
846
+ ds = TripLeg.live_departures.
847
+ filter( :depart_date_key >= :$from_date).filter( :depart_date_key <= :$to_date ).
848
+ eager_graph(:crew_legs => :position_code).eager_graph(:aircraft,:trip).
849
+ select_fields(
850
+ :self => [:trip_number, :leg_number, :arrival_icao, :departure_icao, :requester,
851
+ :time_zone_change, :dept_date_gmt, :arrival_date_gmt, :depart_date_local,
852
+ :arrival_date_local, :ete, :etd_local, :eta_local, :etd_gmt, :eta_gmt, :dept_date_act_gmt,
853
+ :status, :closed, :cancelled, :cancel_code, :passengers_actual, :pax_count],
854
+ :crew_legs => [:crew, :position],
855
+ :crew_legs__position_code => [:code],
856
+ :trip => [:approval_code], # picked just any field so i can get the primary key fields also
857
+ :aircraft => [:max_pax, :tail_number]).
858
+ order(:'trip legs__trip_number',:'trip legs__leg_number')
859
+ @live_departures_by_date_ps = ds.prepare(:select, :live_departures_by_date_ps)
860
+ end
861
+ @live_departures_by_date_ps.call(:from_date=> from_date.to_fos_days, :to_date => to_date.to_fos_days)
862
+ end
863
+
864
+ def self.live_departures_by_date(date)
865
+ live_departures_by_date_range(date, date)
866
+ end
867
+
868
+ def self.daily_report_by_date_range(from_date, to_date)
869
+ unless @daily_report_by_date_ps
870
+ ds = TripLeg.live_departures.
871
+ filter( :depart_date_key >= :$from_date).filter( :depart_date_key <= :$to_date ).
872
+ filter( :cancel_code => 0).
873
+ eager_graph(:crew_legs => :position_code).eager_graph(:aircraft).
874
+ select_fields(
875
+ :self => [:trip_number, :leg_number, :arrival_icao, :departure_icao, :requester,
876
+ :time_zone_change, :dept_date_gmt, :arrival_date_gmt, :depart_date_local,
877
+ :arrival_date_local, :ete, :etd_local, :eta_local, :etd_gmt, :eta_gmt,
878
+ :status, :closed, :cancelled, :cancel_code, :passengers_actual, :pax_count],
879
+ :crew_legs => [:crew, :position],
880
+ :crew_legs__position_code => [:code],
881
+ :aircraft => [:max_pax, :tail_number]).
882
+ order(:'trip legs__trip_number',:'trip legs__leg_number')
883
+ @daily_report_by_date_ps = ds.prepare(:select, :daily_report_by_date_ps)
884
+ end
885
+ @daily_report_by_date_ps.call(:from_date=> from_date.to_fos_days, :to_date => to_date.to_fos_days)
886
+ end
887
+
888
+ def self.daily_report_by_date(date)
889
+ daily_report_by_date_range(date, date)
890
+ end
891
+
892
+ def self.scheduled_maintenance_in_date_range(from_date, to_date)
893
+ maintenance_leg.filter(:depart_date_key => from_date.to_fos_days..to_date.to_fos_days)
894
+ end
895
+
896
+ ##### for the trip_report query/service on crewres #######
897
+ # fields to return
898
+ TRIP_REPORT_FIELDS = [:trip_number, :leg_number,
899
+ :departure_icao_val, :arrival_icao_val, :aircraft_type_id, :tail_number,
900
+ :statute_miles, :trip_total_statute_miles, :miles, :fuel_burned,
901
+ :passengers_actual, :pax_count, :trip_status,
902
+ :planned_departure_date_local, :planned_departure_time_local_view,
903
+ :actual_arrival_date_local, :planned_arrival_time_local_view,
904
+ :actual_departure_time_gmt_view, :actual_arrival_time_gmt_view,
905
+ :actual_takeoff_time_gmt_view, :actual_land_time_gmt_view,
906
+ :eft_time, :ebt_time, :aft_time, :abt_time ]
907
+
908
+ def self.trip_report(from_date, to_date, hash)
909
+ extra_fields = hash['extra_fields'] ? hash['extra_fields'] : []
910
+ filters = []
911
+ filters << [const_get(hash['status_filter'])] if hash['status_filter']
912
+ filters << [LIMIT_AIRCRAFT_IDS, hash['aircraft_id_filter']] if hash['aircraft_id_filter']
913
+ filters << [LIMIT_REPORT_REQUESTER, hash['requester_filter']] if hash['requester_filter']
914
+ filters << [const_get(hash['regional_filter'])] if hash['regional_filter']
915
+ filters << [const_get(hash['icao_filter'][0]), hash['icao_filter'][1].split(',')] if hash['icao_filter']
916
+ # perform query and use filters ( if any ) to select trips that match
917
+ trip_legs = trip_report_query(from_date, to_date, extra_fields).select do |tl|
918
+ # all filters applied must be true, so finding one being false will deselect this trip leg
919
+ !filters.find{|filter, args| filter.call(tl,args) == false}
920
+ end
921
+ return trip_legs, {:methods=>(TRIP_REPORT_FIELDS + extra_fields)}
922
+ end
923
+
924
+ TRIP_REPORT_SELECT_FIELDS = { # fields to select in the query
925
+ :self => [:status, :cancel_code, :trip_number, :leg_number,
926
+ :requester_kid_date, :requester_kid_time, :requester_kid_mult, :requester_kid_comm,
927
+ :arrival_icao, :departure_icao, :depart_ap_prefix, :depart_airport_id, :aircraft_type_id,
928
+ :arrival_ap_prefix, :arrival_airport_id, :arrival_iata, :departure_iata,
929
+ :statute_miles, :fuel_burned, :regulation, :leg_type_code, :passengers_actual, :pax_count,
930
+ :dept_date_gmt, :dept_time_act_gmt, :arrival_date_gmt, :depart_date_local, :arriv_time_act_gmt,
931
+ :arrival_date_gmt, :arrival_date_local, :ete, :etd_local, :eta_local, :etd_gmt, :eta_gmt,
932
+ :t_o_time_act_gmt, :land_time_act_gmt, :eft, :flight_time_actual, :block_time_actual],
933
+ :aircraft => [:type_id, :tail_number, :aircraft_id],
934
+ :trip => [:total_statute_miles] }
935
+
936
+ EAGER_GRAPH_OPTIONS = [:aircraft, :trip]
937
+
938
+ def self.trip_report_query(from_date, to_date, extra_fields)
939
+ filter_args = {~:'trip legs__status'=> 31, :depart_date_key => from_date.to_fos_days..to_date.to_fos_days}
940
+ selecting_fields = TRIP_REPORT_SELECT_FIELDS.dup
941
+ eager_graph_options = EAGER_GRAPH_OPTIONS.dup
942
+ if extra_fields.include?('pic')
943
+ selecting_fields.merge!(:crew_legs => [:crew, :position],:crew_legs__position_code => [:code])
944
+ eager_graph_options += [{:crew_legs => :position_code}]
945
+ elsif extra_fields.include?('trip_requester_name')
946
+ selecting_fields.merge!(:trip_requester => [:name])
947
+ eager_graph_options += [:trip_requester]
948
+ end
949
+ TripLeg.filter(filter_args).eager_graph(eager_graph_options).select_fields(selecting_fields).all
950
+ end
951
+
952
+ #### aliases and special methods #####
953
+ # This method guarantees an icao for a view that needs one. If there is an icao, use it, otherwise make
954
+ # it from the prefix and airport_id .. which works as an icao, but beware, because these put together
955
+ # icao's that you make are valid icao codes, but you can't search the airport based it, since these
956
+ # airport rows don't have an icao code at all, they only have the prefix and airport_id. whacky.
957
+ def departure_icao_val
958
+ departure_icao || depart_ap_prefix + depart_airport_id
959
+ end
960
+
961
+ # same comment as above
962
+ def arrival_icao_val
963
+ arrival_icao || arrival_ap_prefix + arrival_airport_id
964
+ end
965
+
966
+ def departure_icao_expanded
967
+ "#{departure_icao_val} #{departure_airport.name} #{departure_airport.city} ,#{departure_airport.state_abbreviation}"
968
+ end
969
+
970
+ def arrival_icao_expanded
971
+ "#{arrival_icao_val} #{arrival_airport.name} #{arrival_airport.city} ,#{arrival_airport.state_abbreviation}"
972
+ end
973
+
974
+ def trip_status
975
+ return "CANC" if cancel_code != 0
976
+ case status
977
+ when 0 then "SCHED"
978
+ when 1 then "VERI"
979
+ when 10 then "CANC"
980
+ when 23 then "CANC"
981
+ when 21 then "MAINT"
982
+ when 20 then "SCHED" #was "RESVD"
983
+ else "[#{status}]"
984
+ end
985
+ end
986
+
987
+ def trip_total_statute_miles
988
+ trip ? trip.total_statute_miles.to_f/10.0 : 0
989
+ end
990
+
991
+ alias miles statute_miles
992
+
993
+ # special id which mushes 4 of the requester kids together.
994
+ # don't need 5th one( kid_user ) to get unique value, so not using it
995
+ def requester_id
996
+ [requester_kid_date,requester_kid_time,requester_kid_mult,requester_kid_comm].join('|')
997
+ end
998
+
999
+ #### status filters ##### ["CANC","SCHED", "VERI"]
1000
+ LIMIT_REPORT_STATUS_ONLY_UNVERIFIED = lambda {|v,args| ["CANC","SCHED"].include?(v.trip_status) }
1001
+ LIMIT_REPORT_STATUS_ONLY_VERIFIED = lambda {|v,args| ["VERI"].include?(v.trip_status) }
1002
+ LIMIT_REPORT_STATUS_ONLY_SCHEDULED = lambda {|v,args| ["SCHED"].include?(v.trip_status) }
1003
+ LIMIT_REPORT_STATUS_ONLY_UNVERIFIED_SHOW_CANCELLED_LEGS = lambda {|v,args| ["CANC","SCHED"].include?(v.trip_status) }
1004
+ LIMIT_REPORT_STATUS_ONLY_VERIFIED_SHOW_CANCELLED_LEGS = lambda {|v,args| ["CANC","VERI"].include?(v.trip_status) }
1005
+ LIMIT_REPORT_STATUS_ONLY_SCHEDULED_SHOW_CANCELLED_LEGS = lambda {|v,args| ["CANC","SCHED"].include?(v.trip_status) }
1006
+ SHOW_CANCELLED_LEGS = lambda {|v,args| ["CANC"].include?(v.trip_status) }
1007
+ #### region filters #####
1008
+ US_PREFIXES = ["K","PA","PF","PO","PP","PH"]
1009
+ LIMIT_REPORT_REGION_ONLY_INTERNATIONAL = lambda {|v,args| !US_PREFIXES.include?(v.depart_ap_prefix) }
1010
+ LIMIT_REPORT_REGION_ONLY_USA = lambda {|v,args| US_PREFIXES.include?(v.depart_ap_prefix) }
1011
+ #### request filter #####
1012
+ LIMIT_REPORT_REQUESTER = lambda {|v,requester_id| v.requester_id == requester_id }
1013
+ #### aircraft id filter #####
1014
+ LIMIT_AIRCRAFT_IDS = lambda {|v,aircraft_ids| aircraft_ids.include?(v.aircraft_id) }
1015
+ #### city pair filters #####
1016
+ LIMIT_CITY_PAIR_FROM_ICAO = lambda {|trip_leg,icao_arr| icao_arr.include?(trip_leg.departure_icao_val) }
1017
+ LIMIT_CITY_PAIR_TO_ICAO = lambda {|trip_leg,icao_arr| icao_arr.include?(trip_leg.arrival_icao_val) }
1018
+ LIMIT_CITY_PAIR_FROM_ICAO_COUNTRY_CODE = lambda {|trip_leg,country_codes| country_codes.include?(trip_leg.depart_ap_prefix) }
1019
+ LIMIT_CITY_PAIR_TO_ICAO_COUNTRY_CODE = lambda {|trip_leg,country_codes| country_codes.include?(trip_leg.arrival_ap_prefix) }
1020
+ CITY_PAIR_SPECIFIC_FIELDS = [:depart_ap_prefix, :departure_iata, :arrival_ap_prefix, :arrival_iata]
1021
+ # The vars param is an array of filters for the 4 fields that correspond to CITY_PAIR_SPECIFIC_FIELDS.
1022
+ # If the vars array is ['K','SFO'] then this filter should check that the depart_ap_prefix matches 'K'
1023
+ # and the depart_iata matches 'SFO'.
1024
+ LIMIT_CITY_PAIR_SPECIFIC = lambda {|trip_leg,vars|
1025
+ CITY_PAIR_SPECIFIC_FIELDS.enum_with_index.find{|field,idx|
1026
+ # check to see if the field value is not equal to the filter but only check if there is a filter for that field
1027
+ trip_leg.send(field) != vars[idx] unless vars[idx].blank?
1028
+ }.blank?
1029
+ # if all matched ok, then returns nil, and if one of the filters did not match then will have
1030
+ # the value of that non matching field. So, if result is blank?, this trip leg is valid
1031
+ }
1032
+ ##### END the trip_report query/service on crewres #######
1033
+
1034
+
1035
+ ############ kbi report ###############
1036
+ def is_deadhead?
1037
+ status==1 and (deadhead==1 or pax_count==0) and [107, 115, 108, 104].include? leg_type_code
1038
+ end
1039
+
1040
+ def is_owner_occupied?
1041
+ status==1 and deadhead==0 and pax_count>0 and [107, 115, 108, 104].include? leg_type_code
1042
+ end
1043
+
1044
+ def self.kbi_stats(date)
1045
+ start_date_month, end_date_month = date.beginning_of_month, date.end_of_month
1046
+ start_date_week, end_date_week = date.beginning_of_week.to_fos_days, date.end_of_week.to_fos_days
1047
+
1048
+ hash = Hash.new {|k,v| k[v]=0}
1049
+
1050
+ trips = TripLeg.filter(:arrival_date_home=>start_date_month.to_fos_days..end_date_month.to_fos_days).
1051
+ select(:arrival_date_home, :aircraft_type_id, :flight_time_actual, :eft, :status, :pax_count, :deadhead, :leg_type_code)
1052
+
1053
+ occupied_hours = 0
1054
+
1055
+ trips.each do |trip|
1056
+ # hours scheduled/flown per aircraft type
1057
+ if ["C750","CL30"].include? trip.aircraft_type_id
1058
+ # month totals
1059
+ hash["hours_scheduled_month_#{trip.aircraft_type_id}"] += trip.eft / 60.0
1060
+ hash["hours_flown_month_#{trip.aircraft_type_id}"] += (trip.flight_time_actual / 60.0) if trip.status == 1
1061
+ # week totals
1062
+ if trip.arrival_date_home.between? start_date_week,end_date_week
1063
+ hash["hours_scheduled_week_#{trip.aircraft_type_id}"] += trip.eft / 60.0
1064
+ end
1065
+ end
1066
+ # month charter hours scheduled/flown
1067
+ if [100,11].include? trip.leg_type_code
1068
+ hash["hours_scheduled_month_charter"] += trip.eft / 60.0
1069
+ hash["hours_flown_month_charter"] += (trip.flight_time_actual / 60.0) if trip.status == 1
1070
+ end
1071
+
1072
+ # owner deadhead month hours flown
1073
+ hash[:hours_flown_month_deadhead] += trip.flight_time_actual / 60.0 if trip.is_deadhead?
1074
+ # owner deadhead month hours flown
1075
+ hash[:hours_flown_month_owner] += trip.flight_time_actual / 60.0 if trip.is_owner_occupied?
1076
+
1077
+ # other hours flown month
1078
+ hash[:hours_flown_month_other] += trip.flight_time_actual / 60.0 if !([100,11,107,115,108,104].include? trip.leg_type_code)
1079
+
1080
+ # monthly passenger occupied hours
1081
+ if trip.pax_count > 0 && trip.deadhead == 0 and trip.status == 1
1082
+ occupied_hours += trip.flight_time_actual / 60.0
1083
+ end
1084
+ end
1085
+
1086
+ # calculate passenger utilization
1087
+ hours_flown = hash["hours_flown_month_C750"] + hash["hours_flown_month_CL30"]
1088
+ hash[:passenger_utilization] = (occupied_hours / hours_flown)*100 rescue 0
1089
+ # owner guaranteed deadhead percentage month
1090
+ hash[:owner_guarantee_deadhead] = (hash[:hours_flown_month_deadhead] / (hash[:hours_flown_month_deadhead] + hash[:hours_flown_month_owner])) * 100 rescue 0
1091
+ hash
1092
+ end
1093
+
1094
+ CUST_SATISFACTION_FIELDS =
1095
+ [:status_code, :actual_departure_date_gmt, :actual_departure_trip]
1096
+
1097
+ # filtering on these leg_type codes ["FXL", 107], ["FXM", 115], ["FXO", 108], ["TPGC", 121], ["TPGP", 122], ["XOLP", 104]
1098
+ #
1099
+ def customer_satisfaction_trip_report(date)
1100
+ trips = Trip.filter(:status=>1, ~:cancel_code=>1, :leg_type_code=> [104,107,108,115,121,122], :arrival_date_gmt=>date.to_fos_days).all
1101
+
1102
+ # :status, :dept_date_act_local, :dept_time_act_local, :requester
1103
+ # :leg_requestor => [:name, :authorizer_string ]
1104
+
1105
+
1106
+ # :status_code
1107
+ # :actual_departure_date_local, :actual_departure_time_local,
1108
+ # leg_requestor_name, :lead_pax_name
1109
+ # lead pax info: lead_pax.passenger.pax_office_phone, pax_email
1110
+ # planner info: lead_pax.passenger.travel_planner, pl_office_phone , pl_email
1111
+ # :depture_icao, :arrival_icao,
1112
+ # :leg_number
1113
+ # leg_requestor.authorizer_string, leg_requestor.name
1114
+ #
1115
+ # delay_1_time, :delay_1_reson
1116
+ # :statute_miles
1117
+ end
1118
+
1119
+ #pp ts.collect{|t| t.trip_legs.collect{|tl| [tl.trip_number,tl.leg_number,tl.arrival_date_gmt,tl.arriv_time_act_gmt,tl.leg_type_code,tl.leg_type_value_code,tl.is_deadhead?]}}
1120
+
1121
+ # [[[68302, 1, 39928, 996, 11, "WHSL", false],
1122
+ # [68302, 2, 39928, 1332, 11, "WHSL", false]],
1123
+ # [[68085, 1, 39924, 684, 11, "WHSL", false],
1124
+ # [68085, 2, 39924, 930, 11, "WHSL", false],
1125
+ # [68085, 3, 39928, 1224, 11, "WHSL", false]],
1126
+ # [[68206, 1, 39927, 1050, 107, "FXL", true],
1127
+ # [68206, 2, 39928, 1218, 107, "FXL", false],
1128
+ # [68206, 3, 39928, 1242, 107, "FXL", true]],
1129
+ # [[68376, 1, 39928, 216, 107, "FXL", false],
1130
+ # [68376, 2, 39928, 222, 107, "FXL", true]],
1131
+ # [[68437, 1, 39928, 1068, 107, "FXL", true],
1132
+ # [68437, 2, 39928, 1308, 107, "FXL", false]],
1133
+ # [[68550, 1, 39928, 1164, 107, "FXL", true],
1134
+ # [68550, 2, 39928, 1398, 107, "FXL", false]],
1135
+ # [[68552, 1, 39928, 1332, 107, "FXL", false]],
1136
+ # [[68576, 1, 39928, 1404, 107, "FXL", false]],
1137
+ # [[68604, 1, 39928, 876, 107, "FXL", true],
1138
+ # [68604, 2, 39928, 1218, 107, "FXL", false]],
1139
+ # [[68607, 1, 39927, 1104, 107, "FXL", true],
1140
+ # [68607, 2, 39928, 738, 107, "FXL", false],
1141
+ # [68607, 3, 39928, 1026, 107, "FXL", false],
1142
+ # [68607, 4, 39928, 1074, 107, "FXL", true]],
1143
+ # [[68610, 1, 39928, 1122, 11, "WHSL", false],
1144
+ # [68610, 2, 39928, 1356, 11, "WHSL", false],
1145
+ # [68610, 3, 39928, 1374, 11, "WHSL", false]]]
1146
+ end
1147
+
1148
+
1149
+