billing 0.0.9 → 0.1.0a

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5aaf6345b7a91cc0df617048d93da36900ca1cc4
4
- data.tar.gz: f99bb213cb8264b2247a9ba5156804397bff807b
3
+ metadata.gz: bdd7495c66cfacd842fd55916bf4449fd8d9871c
4
+ data.tar.gz: 8ac3bbaa57155b5774031c8ee5858bbde682001c
5
5
  SHA512:
6
- metadata.gz: 82b21b36a0434f25cf474e3a5b83967e86fd6d6e2e68d50d5773c4dc0b8ea9fb87f32114403c8f5e017b2590b8d5290e82c72559908d00075b1f4aa3822e9b84
7
- data.tar.gz: 1c1fcb92d3abd50601794356b4fb6a06dd34f02a8127b72fcb321283f9cdf22710b914751b7943b90ef13d92b843f19f93c351c555de5e2c556bc503f2126250
6
+ metadata.gz: abaf03a7d7b75ea3e05f94fdbe9eea5943fabe3cfab69b6f8c25509b187ffb57037ed64b9ccfe777fcc27f3a8a4238157f60915556120662dd2973f9b0eebc1c
7
+ data.tar.gz: ff0aab102ae9b9d95d98d85a7c227375277edad2c8e83aa0ab0c31aef5f86b97b4cfe4900952fdfe4807631f3c001799a8f684eedca9938f4462573252637def
@@ -29,15 +29,32 @@ module Billing
29
29
  s.print "\r\n------------------------------\r\n"
30
30
 
31
31
  bill.charges.each do |charge|
32
- s.print "#{charge.name.ljust(22)} #{charge.value.to_s.rjust(7)}\r\n"
32
+ text = "#{charge.qty ? charge.qty : 1} x #{charge.name}"
33
+ s.print "\r\n#{text.truncate(22).ljust(22)} #{charge.price.to_s.rjust(7)}\r\n"
34
+ if charge.description
35
+ s.print "#{charge.description.truncate(30)}\r\n"
36
+ end
33
37
  if charge.modifier.present?
34
- s.print " Item modifier: #{charge.modifier.human.to_s.rjust(7)}\r\n"
38
+ text = charge.modifier.percent_ratio.nil? ? "" : " #{charge.modifier.percentage}"
39
+ if charge.modifier.positive?
40
+ text += " Surcharge"
41
+ else
42
+ text += " Discount"
43
+ end
44
+ s.print "#{text.ljust(22)} #{(charge.value - charge.price).to_s.rjust(7)}\r\n"
35
45
  end
36
46
  end
37
- if bill.modifiers.any?
38
- s.print " Global modifier: #{bill.global_modifier_value.to_s.rjust(7)}\r\n"
39
- end
40
47
  s.print "-----------\r\n".rjust(32)
48
+ if bill.modifiers.global.any?
49
+ global_modifier = bill.modifiers.global.first
50
+ text = global_modifier.percent_ratio.nil? ? "" : " #{global_modifier.percentage}"
51
+ if global_modifier.positive?
52
+ text += " Surcharge"
53
+ else
54
+ text += " Discount"
55
+ end
56
+ s.print "#{text.ljust(22)} #{bill.global_modifier_value.to_s.rjust(7)}\r\n"
57
+ end
41
58
  s.print "TOTAL: #{bill.total.to_s.rjust(20)}\r\n"
42
59
 
43
60
  # s.print "..............................\r\n"
@@ -2,7 +2,9 @@ module Billing
2
2
  class Bill < ActiveRecord::Base
3
3
  acts_as_paranoid if respond_to?(:acts_as_paranoid)
4
4
  has_paper_trail class_name: 'Billing::Version' if respond_to?(:has_paper_trail)
5
-
5
+
6
+ attr_accessor :perform_print, :perform_fiscalize
7
+
6
8
  monetize :charges_sum_cents
7
9
  monetize :discounts_sum_cents
8
10
  monetize :surcharges_sum_cents
@@ -40,8 +42,8 @@ module Billing
40
42
  self.name = "B:#{number}" if name.nil?
41
43
  end
42
44
  before_save :perform_autofin, if: :becomes_paid?
43
- after_save :create_fiscal_job, if: :fiscalizable?
44
- after_save :create_print_job, if: :printable?
45
+ after_commit :create_fiscal_job, on: [ :create, :update ]
46
+ after_commit :create_print_job, on: [ :create, :update ]
45
47
 
46
48
  validates_numericality_of :total, greater_than_or_equal_to: 0
47
49
  validates_numericality_of :balance, less_than_or_equal_to: 0
@@ -130,12 +132,15 @@ module Billing
130
132
  def calculate_modifiers
131
133
  charges_a = charges.to_a
132
134
  @modifier_items = ModifierItems.new.tap() do |items|
133
- modifiers.select{ |m| m.charge.present? }.each do |charge_modifier|
134
- charge = charges_a.find{ |c| c == charge_modifier.charge }
135
- mod_value = charge_modifier.percent_ratio.nil? ? charge_modifier.fixed_value : (charge_modifier.charge.price * charge_modifier.percent_ratio)
135
+ # modifiers.select{ |m| m.charge.present? }.each do |charge_modifier|
136
+ # charge = charges_a.find{ |c| c == charge_modifier.charge }
137
+ # mod_value = charge_modifier.percent_ratio.nil? ? charge_modifier.fixed_value : (charge_modifier.charge.price * charge_modifier.percent_ratio)
138
+ # charge.value = charge.price + mod_value
139
+ # items << Charge.new(price: mod_value, chargable: charge)
140
+ # end
141
+ charges_a.select{ |c| c.modifier.present? }.each do |charge|
142
+ mod_value = charge.modifier.percent_ratio.nil? ? charge.modifier.fixed_value : (charge.modifier.charge.price * charge.modifier.percent_ratio)
136
143
  charge.value = charge.price + mod_value
137
- #p charge.value
138
- #p "-"
139
144
  items << Charge.new(price: mod_value, chargable: charge)
140
145
  end
141
146
  modifiers.select{ |m| m.charge.nil? }.each do |global_modifier|
@@ -145,7 +150,7 @@ module Billing
145
150
  end
146
151
  def update_sumaries
147
152
  calculate_modifiers
148
- self.charges_sum = charges.to_a.sum(0.to_money, &:value).to_money
153
+ self.charges_sum = charges.to_a.sum(0.to_money, &:price).to_money
149
154
  self.discounts_sum = @modifier_items.discounts.sum(0.to_money, &:price).to_money
150
155
  self.surcharges_sum = @modifier_items.surcharges.sum(0.to_money, &:price).to_money
151
156
  self.payments_sum = payments.to_a.sum(0.to_money, &:value).to_money
@@ -170,38 +175,33 @@ module Billing
170
175
  end
171
176
 
172
177
  def perform_autofin
173
- p "!!!!!!!!!!perform_autofin"
174
178
  if autofin
175
179
  self.finalized_at = Time.now
176
180
  if defined?(Extface) && fiscalizable? && device = origin.try(:fiscal_device)
177
181
  #self.extface_job = origin.fiscal_device.driver.fiscalize(self) if fiscalizable? && origin.try(:fiscal_device)
178
182
  self.extface_job = device.jobs.new
183
+ self.perform_fiscalize = true
179
184
  end
180
185
  if defined?(Extface) && printable? && print_device = origin.try(:print_device)
181
186
  #self.extface_job = origin.fiscal_device.driver.fiscalize(self) if fiscalizable? && origin.try(:fiscal_device)
182
187
  self.print_job = print_device.jobs.new
188
+ self.perform_print = true
183
189
  end
184
190
  end
185
191
  true
186
192
  end
187
193
 
188
194
  def create_fiscal_job
189
- if self.extface_job_id_changed? && defined?(Resque) && defined?(Extface) && device = origin.try(:fiscal_device)
190
- p "device: #{device.try(:id)}"
191
- p "self: #{self.try(:id)}"
192
- p "self.finalized_at changed: #{self.finalized_at_changed?}"
193
-
195
+ if @perform_fiscalize && defined?(Resque) && defined?(Extface) && device = origin.try(:fiscal_device)
194
196
  Resque.enqueue_to("extface_#{device.id}", Billing::IssueFiscalDoc, self.id)
195
- end
197
+ end if fiscalizable?
196
198
  true
197
199
  end
198
200
 
199
201
  def create_print_job
200
- if self.print_job_id_changed? && defined?(Resque) && defined?(Extface) && print_device = origin.try(:print_device)
201
- p "################ vprint device: #{print_device.try(:id)}"
202
- p "self: #{self.try(:id)}"
202
+ if @perform_print && defined?(Resque) && defined?(Extface) && print_device = origin.try(:print_device)
203
203
  Resque.enqueue_to("extface_#{print_device.id}", Billing::IssuePrintDoc, self.id)
204
- end
204
+ end if printable?
205
205
  true
206
206
  end
207
207
  end
@@ -22,7 +22,7 @@ module Billing
22
22
  validates_numericality_of :value, greater_than_or_equal_to: 0
23
23
 
24
24
  after_initialize do
25
- self.value = price #unless modifier.present? #bill validation will update modified value
25
+ self.value = price if self.new_record? #unless modifier.present? #bill validation will update modified value
26
26
  end
27
27
 
28
28
  def find_tax_group_mapping_for(fiscal_driver) # optimize and remove me!
@@ -1,7 +1,7 @@
1
1
  module Billing
2
2
  class Modifier < ActiveRecord::Base
3
3
  include BillItem
4
- belongs_to :bill, inverse_of: :modifiers, validate: true
4
+ belongs_to :bill, inverse_of: :modifiers#, validate: true
5
5
  belongs_to :charge, inverse_of: :modifier
6
6
  monetize :fixed_value_cents
7
7
 
@@ -11,8 +11,12 @@ module Billing
11
11
  validates_uniqueness_of :charge, scope: :bill_id, allow_nil: true
12
12
  validates_uniqueness_of :bill, scope: :charge_id
13
13
 
14
- def human
15
- percent_ratio.nil? ? fixed_value : "#{(percent_ratio * 100).to_i}%"
14
+ def percentage
15
+ percent_ratio.nil? ? "" : "#{(percent_ratio * 100).to_i}%"
16
+ end
17
+
18
+ def positive?
19
+ percent_ratio.nil? ? fixed_value_cents > 0 : percent_ratio > 0
16
20
  end
17
21
 
18
22
  private
@@ -9,6 +9,8 @@ module Billing
9
9
  delegate :save, to: :bill, prefix: :bill
10
10
  delegate :origins, :payment_types, :tax_groups, to: :bill
11
11
 
12
+ validates_presence_of :bill
13
+
12
14
  after_save :bill_save
13
15
  after_destroy :bill_save
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module Billing
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0a"
3
3
  end
Binary file
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150512040421) do
14
+ ActiveRecord::Schema.define(version: 20160824235224) do
15
15
 
16
16
  create_table "billing_bills", force: :cascade do |t|
17
17
  t.integer "billable_id"
@@ -38,6 +38,7 @@ ActiveRecord::Schema.define(version: 20150512040421) do
38
38
  t.string "name", limit: 255
39
39
  t.string "number", limit: 255
40
40
  t.datetime "deleted_at"
41
+ t.integer "print_job_id"
41
42
  end
42
43
 
43
44
  add_index "billing_bills", ["billable_id", "billable_type"], name: "index_billing_bills_on_billable_id_and_billable_type"
@@ -134,6 +135,9 @@ ActiveRecord::Schema.define(version: 20150512040421) do
134
135
  t.string "type", limit: 255
135
136
  t.string "payment_model", limit: 255, default: "Billing::PaymentWithType"
136
137
  t.integer "transfer_device_id"
138
+ t.integer "print_device_id"
139
+ t.string "print_header"
140
+ t.string "print_footer"
137
141
  end
138
142
 
139
143
  add_index "billing_origins", ["deleted_at"], name: "index_billing_origins_on_deleted_at"
Binary file
@@ -2809,4 +2809,488 @@ Migrating to AddDeletedAtToBillingReport (20150512040421)
2809
2809
  SELECT sql
2810
2810
  FROM sqlite_temp_master
2811
2811
  WHERE name='index_billing_versions_on_item_type_and_item_id' AND type='index'
2812
+ 
2813
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
2814
+ Migrating to AddPrintDeviceToBillingOrigin (20160723160908)
2815
+  (0.1ms) begin transaction
2816
+  (0.4ms) ALTER TABLE "billing_origins" ADD "print_device_id" integer
2817
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160723160908"]]
2818
+  (115.6ms) commit transaction
2819
+ Migrating to AddPrintJobToBillingBill (20160723234233)
2820
+  (0.3ms) begin transaction
2821
+  (1.8ms) ALTER TABLE "billing_bills" ADD "print_job_id" integer
2822
+ SQL (0.5ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160723234233"]]
2823
+  (140.1ms) commit transaction
2824
+ Migrating to AddPrintHeadersToBillingOrigin (20160824235224)
2825
+  (0.2ms) begin transaction
2826
+  (0.8ms) ALTER TABLE "billing_origins" ADD "print_header" varchar
2827
+  (0.4ms) ALTER TABLE "billing_origins" ADD "print_footer" varchar
2828
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160824235224"]]
2829
+  (116.1ms) commit transaction
2830
+ ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
2831
+  (0.5ms) SELECT sql
2832
+ FROM sqlite_master
2833
+ WHERE name='index_billing_bills_on_billable_id_and_billable_type' AND type='index'
2834
+ UNION ALL
2835
+ SELECT sql
2836
+ FROM sqlite_temp_master
2837
+ WHERE name='index_billing_bills_on_billable_id_and_billable_type' AND type='index'
2838
+
2839
+  (0.3ms)  SELECT sql
2840
+ FROM sqlite_master
2841
+ WHERE name='index_billing_bills_on_origin_id' AND type='index'
2842
+ UNION ALL
2843
+ SELECT sql
2844
+ FROM sqlite_temp_master
2845
+ WHERE name='index_billing_bills_on_origin_id' AND type='index'
2846
+ 
2847
+  (0.3ms) SELECT sql
2848
+ FROM sqlite_master
2849
+ WHERE name='index_billing_bills_on_extface_job_id' AND type='index'
2850
+ UNION ALL
2851
+ SELECT sql
2852
+ FROM sqlite_temp_master
2853
+ WHERE name='index_billing_bills_on_extface_job_id' AND type='index'
2854
+
2855
+  (0.2ms)  SELECT sql
2856
+ FROM sqlite_master
2857
+ WHERE name='index_billing_bills_on_report_id' AND type='index'
2858
+ UNION ALL
2859
+ SELECT sql
2860
+ FROM sqlite_temp_master
2861
+ WHERE name='index_billing_bills_on_report_id' AND type='index'
2862
+ 
2863
+  (0.2ms) SELECT sql
2864
+ FROM sqlite_master
2865
+ WHERE name='index_billing_charges_on_bill_id' AND type='index'
2866
+ UNION ALL
2867
+ SELECT sql
2868
+ FROM sqlite_temp_master
2869
+ WHERE name='index_billing_charges_on_bill_id' AND type='index'
2870
+
2871
+  (0.2ms)  SELECT sql
2872
+ FROM sqlite_master
2873
+ WHERE name='index_billing_charges_on_revenue_at' AND type='index'
2874
+ UNION ALL
2875
+ SELECT sql
2876
+ FROM sqlite_temp_master
2877
+ WHERE name='index_billing_charges_on_revenue_at' AND type='index'
2878
+ 
2879
+  (0.2ms) SELECT sql
2880
+ FROM sqlite_master
2881
+ WHERE name='index_billing_charges_on_deleted_at' AND type='index'
2882
+ UNION ALL
2883
+ SELECT sql
2884
+ FROM sqlite_temp_master
2885
+ WHERE name='index_billing_charges_on_deleted_at' AND type='index'
2886
+
2887
+  (0.2ms)  SELECT sql
2888
+ FROM sqlite_master
2889
+ WHERE name='index_billing_charges_on_origin_id' AND type='index'
2890
+ UNION ALL
2891
+ SELECT sql
2892
+ FROM sqlite_temp_master
2893
+ WHERE name='index_billing_charges_on_origin_id' AND type='index'
2894
+ 
2895
+  (0.3ms) SELECT sql
2896
+ FROM sqlite_master
2897
+ WHERE name='index_billing_charges_on_chargable_id_and_chargable_type' AND type='index'
2898
+ UNION ALL
2899
+ SELECT sql
2900
+ FROM sqlite_temp_master
2901
+ WHERE name='index_billing_charges_on_chargable_id_and_chargable_type' AND type='index'
2902
+
2903
+  (0.2ms)  SELECT sql
2904
+ FROM sqlite_master
2905
+ WHERE name='index_billing_departments_on_deleted_at' AND type='index'
2906
+ UNION ALL
2907
+ SELECT sql
2908
+ FROM sqlite_temp_master
2909
+ WHERE name='index_billing_departments_on_deleted_at' AND type='index'
2910
+ 
2911
+  (0.2ms) SELECT sql
2912
+ FROM sqlite_master
2913
+ WHERE name='index_billing_departments_on_tax_group_id' AND type='index'
2914
+ UNION ALL
2915
+ SELECT sql
2916
+ FROM sqlite_temp_master
2917
+ WHERE name='index_billing_departments_on_tax_group_id' AND type='index'
2918
+
2919
+  (0.2ms)  SELECT sql
2920
+ FROM sqlite_master
2921
+ WHERE name='index_billing_modifiers_on_bill_id' AND type='index'
2922
+ UNION ALL
2923
+ SELECT sql
2924
+ FROM sqlite_temp_master
2925
+ WHERE name='index_billing_modifiers_on_bill_id' AND type='index'
2926
+ 
2927
+  (0.1ms) SELECT sql
2928
+ FROM sqlite_master
2929
+ WHERE name='index_billing_op_fp_mappings_on_operator_id' AND type='index'
2930
+ UNION ALL
2931
+ SELECT sql
2932
+ FROM sqlite_temp_master
2933
+ WHERE name='index_billing_op_fp_mappings_on_operator_id' AND type='index'
2934
+
2935
+  (0.2ms)  SELECT sql
2936
+ FROM sqlite_master
2937
+ WHERE name='index_billing_op_fp_mappings_on_extface_driver_id' AND type='index'
2938
+ UNION ALL
2939
+ SELECT sql
2940
+ FROM sqlite_temp_master
2941
+ WHERE name='index_billing_op_fp_mappings_on_extface_driver_id' AND type='index'
2942
+ 
2943
+  (0.2ms) SELECT sql
2944
+ FROM sqlite_master
2945
+ WHERE name='index_billing_operators_on_deleted_at' AND type='index'
2946
+ UNION ALL
2947
+ SELECT sql
2948
+ FROM sqlite_temp_master
2949
+ WHERE name='index_billing_operators_on_deleted_at' AND type='index'
2950
+
2951
+  (0.1ms)  SELECT sql
2952
+ FROM sqlite_master
2953
+ WHERE name='index_billing_origins_on_transfer_device_id' AND type='index'
2954
+ UNION ALL
2955
+ SELECT sql
2956
+ FROM sqlite_temp_master
2957
+ WHERE name='index_billing_origins_on_transfer_device_id' AND type='index'
2958
+ 
2959
+  (0.2ms) SELECT sql
2960
+ FROM sqlite_master
2961
+ WHERE name='index_billing_origins_on_deleted_at' AND type='index'
2962
+ UNION ALL
2963
+ SELECT sql
2964
+ FROM sqlite_temp_master
2965
+ WHERE name='index_billing_origins_on_deleted_at' AND type='index'
2966
+
2967
+  (0.2ms)  SELECT sql
2968
+ FROM sqlite_master
2969
+ WHERE name='index_billing_origins_on_fiscal_device_id' AND type='index'
2970
+ UNION ALL
2971
+ SELECT sql
2972
+ FROM sqlite_temp_master
2973
+ WHERE name='index_billing_origins_on_fiscal_device_id' AND type='index'
2974
+ 
2975
+  (0.2ms) SELECT sql
2976
+ FROM sqlite_master
2977
+ WHERE name='index_billing_payment_types_on_deleted_at' AND type='index'
2978
+ UNION ALL
2979
+ SELECT sql
2980
+ FROM sqlite_temp_master
2981
+ WHERE name='index_billing_payment_types_on_deleted_at' AND type='index'
2982
+
2983
+  (0.2ms)  SELECT sql
2984
+ FROM sqlite_master
2985
+ WHERE name='index_billing_payments_on_bill_id' AND type='index'
2986
+ UNION ALL
2987
+ SELECT sql
2988
+ FROM sqlite_temp_master
2989
+ WHERE name='index_billing_payments_on_bill_id' AND type='index'
2990
+ 
2991
+  (0.2ms) SELECT sql
2992
+ FROM sqlite_master
2993
+ WHERE name='index_billing_payments_on_deleted_at' AND type='index'
2994
+ UNION ALL
2995
+ SELECT sql
2996
+ FROM sqlite_temp_master
2997
+ WHERE name='index_billing_payments_on_deleted_at' AND type='index'
2998
+
2999
+  (0.2ms)  SELECT sql
3000
+ FROM sqlite_master
3001
+ WHERE name='index_billing_plus_on_department_id' AND type='index'
3002
+ UNION ALL
3003
+ SELECT sql
3004
+ FROM sqlite_temp_master
3005
+ WHERE name='index_billing_plus_on_department_id' AND type='index'
3006
+ 
3007
+  (0.2ms) SELECT sql
3008
+ FROM sqlite_master
3009
+ WHERE name='index_billing_plus_on_tax_group_id' AND type='index'
3010
+ UNION ALL
3011
+ SELECT sql
3012
+ FROM sqlite_temp_master
3013
+ WHERE name='index_billing_plus_on_tax_group_id' AND type='index'
3014
+
3015
+  (0.2ms)  SELECT sql
3016
+ FROM sqlite_master
3017
+ WHERE name='index_billing_pt_fp_mappings_on_payment_type_id' AND type='index'
3018
+ UNION ALL
3019
+ SELECT sql
3020
+ FROM sqlite_temp_master
3021
+ WHERE name='index_billing_pt_fp_mappings_on_payment_type_id' AND type='index'
3022
+ 
3023
+  (0.2ms) SELECT sql
3024
+ FROM sqlite_master
3025
+ WHERE name='index_billing_pt_fp_mappings_on_extface_driver_id' AND type='index'
3026
+ UNION ALL
3027
+ SELECT sql
3028
+ FROM sqlite_temp_master
3029
+ WHERE name='index_billing_pt_fp_mappings_on_extface_driver_id' AND type='index'
3030
+
3031
+  (0.2ms)  SELECT sql
3032
+ FROM sqlite_master
3033
+ WHERE name='index_billing_reports_on_origin_id' AND type='index'
3034
+ UNION ALL
3035
+ SELECT sql
3036
+ FROM sqlite_temp_master
3037
+ WHERE name='index_billing_reports_on_origin_id' AND type='index'
3038
+ 
3039
+  (0.1ms) SELECT sql
3040
+ FROM sqlite_master
3041
+ WHERE name='index_billing_tg_fp_mappings_on_tax_group_id' AND type='index'
3042
+ UNION ALL
3043
+ SELECT sql
3044
+ FROM sqlite_temp_master
3045
+ WHERE name='index_billing_tg_fp_mappings_on_tax_group_id' AND type='index'
3046
+
3047
+  (0.2ms)  SELECT sql
3048
+ FROM sqlite_master
3049
+ WHERE name='index_billing_tg_fp_mappings_on_extface_driver_id' AND type='index'
3050
+ UNION ALL
3051
+ SELECT sql
3052
+ FROM sqlite_temp_master
3053
+ WHERE name='index_billing_tg_fp_mappings_on_extface_driver_id' AND type='index'
3054
+ 
3055
+  (0.2ms) SELECT sql
3056
+ FROM sqlite_master
3057
+ WHERE name='index_billing_versions_on_item_type_and_item_id' AND type='index'
3058
+ UNION ALL
3059
+ SELECT sql
3060
+ FROM sqlite_temp_master
3061
+ WHERE name='index_billing_versions_on_item_type_and_item_id' AND type='index'
3062
+
3063
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
3064
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
3065
+  (0.2ms)  SELECT sql
3066
+ FROM sqlite_master
3067
+ WHERE name='index_billing_bills_on_billable_id_and_billable_type' AND type='index'
3068
+ UNION ALL
3069
+ SELECT sql
3070
+ FROM sqlite_temp_master
3071
+ WHERE name='index_billing_bills_on_billable_id_and_billable_type' AND type='index'
3072
+ 
3073
+  (0.1ms) SELECT sql
3074
+ FROM sqlite_master
3075
+ WHERE name='index_billing_bills_on_origin_id' AND type='index'
3076
+ UNION ALL
3077
+ SELECT sql
3078
+ FROM sqlite_temp_master
3079
+ WHERE name='index_billing_bills_on_origin_id' AND type='index'
3080
+
3081
+  (0.1ms)  SELECT sql
3082
+ FROM sqlite_master
3083
+ WHERE name='index_billing_bills_on_extface_job_id' AND type='index'
3084
+ UNION ALL
3085
+ SELECT sql
3086
+ FROM sqlite_temp_master
3087
+ WHERE name='index_billing_bills_on_extface_job_id' AND type='index'
3088
+ 
3089
+  (0.1ms) SELECT sql
3090
+ FROM sqlite_master
3091
+ WHERE name='index_billing_bills_on_report_id' AND type='index'
3092
+ UNION ALL
3093
+ SELECT sql
3094
+ FROM sqlite_temp_master
3095
+ WHERE name='index_billing_bills_on_report_id' AND type='index'
3096
+
3097
+  (0.1ms)  SELECT sql
3098
+ FROM sqlite_master
3099
+ WHERE name='index_billing_charges_on_bill_id' AND type='index'
3100
+ UNION ALL
3101
+ SELECT sql
3102
+ FROM sqlite_temp_master
3103
+ WHERE name='index_billing_charges_on_bill_id' AND type='index'
3104
+ 
3105
+  (0.2ms) SELECT sql
3106
+ FROM sqlite_master
3107
+ WHERE name='index_billing_charges_on_revenue_at' AND type='index'
3108
+ UNION ALL
3109
+ SELECT sql
3110
+ FROM sqlite_temp_master
3111
+ WHERE name='index_billing_charges_on_revenue_at' AND type='index'
3112
+
3113
+  (0.1ms)  SELECT sql
3114
+ FROM sqlite_master
3115
+ WHERE name='index_billing_charges_on_deleted_at' AND type='index'
3116
+ UNION ALL
3117
+ SELECT sql
3118
+ FROM sqlite_temp_master
3119
+ WHERE name='index_billing_charges_on_deleted_at' AND type='index'
3120
+ 
3121
+  (0.1ms) SELECT sql
3122
+ FROM sqlite_master
3123
+ WHERE name='index_billing_charges_on_origin_id' AND type='index'
3124
+ UNION ALL
3125
+ SELECT sql
3126
+ FROM sqlite_temp_master
3127
+ WHERE name='index_billing_charges_on_origin_id' AND type='index'
3128
+
3129
+  (0.1ms)  SELECT sql
3130
+ FROM sqlite_master
3131
+ WHERE name='index_billing_charges_on_chargable_id_and_chargable_type' AND type='index'
3132
+ UNION ALL
3133
+ SELECT sql
3134
+ FROM sqlite_temp_master
3135
+ WHERE name='index_billing_charges_on_chargable_id_and_chargable_type' AND type='index'
3136
+ 
3137
+  (0.1ms) SELECT sql
3138
+ FROM sqlite_master
3139
+ WHERE name='index_billing_departments_on_deleted_at' AND type='index'
3140
+ UNION ALL
3141
+ SELECT sql
3142
+ FROM sqlite_temp_master
3143
+ WHERE name='index_billing_departments_on_deleted_at' AND type='index'
3144
+
3145
+  (0.1ms)  SELECT sql
3146
+ FROM sqlite_master
3147
+ WHERE name='index_billing_departments_on_tax_group_id' AND type='index'
3148
+ UNION ALL
3149
+ SELECT sql
3150
+ FROM sqlite_temp_master
3151
+ WHERE name='index_billing_departments_on_tax_group_id' AND type='index'
3152
+ 
3153
+  (0.1ms) SELECT sql
3154
+ FROM sqlite_master
3155
+ WHERE name='index_billing_modifiers_on_bill_id' AND type='index'
3156
+ UNION ALL
3157
+ SELECT sql
3158
+ FROM sqlite_temp_master
3159
+ WHERE name='index_billing_modifiers_on_bill_id' AND type='index'
3160
+
3161
+  (0.1ms)  SELECT sql
3162
+ FROM sqlite_master
3163
+ WHERE name='index_billing_op_fp_mappings_on_operator_id' AND type='index'
3164
+ UNION ALL
3165
+ SELECT sql
3166
+ FROM sqlite_temp_master
3167
+ WHERE name='index_billing_op_fp_mappings_on_operator_id' AND type='index'
3168
+ 
3169
+  (0.1ms) SELECT sql
3170
+ FROM sqlite_master
3171
+ WHERE name='index_billing_op_fp_mappings_on_extface_driver_id' AND type='index'
3172
+ UNION ALL
3173
+ SELECT sql
3174
+ FROM sqlite_temp_master
3175
+ WHERE name='index_billing_op_fp_mappings_on_extface_driver_id' AND type='index'
3176
+
3177
+  (0.1ms)  SELECT sql
3178
+ FROM sqlite_master
3179
+ WHERE name='index_billing_operators_on_deleted_at' AND type='index'
3180
+ UNION ALL
3181
+ SELECT sql
3182
+ FROM sqlite_temp_master
3183
+ WHERE name='index_billing_operators_on_deleted_at' AND type='index'
3184
+ 
3185
+  (0.1ms) SELECT sql
3186
+ FROM sqlite_master
3187
+ WHERE name='index_billing_origins_on_transfer_device_id' AND type='index'
3188
+ UNION ALL
3189
+ SELECT sql
3190
+ FROM sqlite_temp_master
3191
+ WHERE name='index_billing_origins_on_transfer_device_id' AND type='index'
3192
+
3193
+  (0.1ms)  SELECT sql
3194
+ FROM sqlite_master
3195
+ WHERE name='index_billing_origins_on_deleted_at' AND type='index'
3196
+ UNION ALL
3197
+ SELECT sql
3198
+ FROM sqlite_temp_master
3199
+ WHERE name='index_billing_origins_on_deleted_at' AND type='index'
3200
+ 
3201
+  (0.1ms) SELECT sql
3202
+ FROM sqlite_master
3203
+ WHERE name='index_billing_origins_on_fiscal_device_id' AND type='index'
3204
+ UNION ALL
3205
+ SELECT sql
3206
+ FROM sqlite_temp_master
3207
+ WHERE name='index_billing_origins_on_fiscal_device_id' AND type='index'
3208
+
3209
+  (0.1ms)  SELECT sql
3210
+ FROM sqlite_master
3211
+ WHERE name='index_billing_payment_types_on_deleted_at' AND type='index'
3212
+ UNION ALL
3213
+ SELECT sql
3214
+ FROM sqlite_temp_master
3215
+ WHERE name='index_billing_payment_types_on_deleted_at' AND type='index'
3216
+ 
3217
+  (0.1ms) SELECT sql
3218
+ FROM sqlite_master
3219
+ WHERE name='index_billing_payments_on_bill_id' AND type='index'
3220
+ UNION ALL
3221
+ SELECT sql
3222
+ FROM sqlite_temp_master
3223
+ WHERE name='index_billing_payments_on_bill_id' AND type='index'
3224
+
3225
+  (0.1ms)  SELECT sql
3226
+ FROM sqlite_master
3227
+ WHERE name='index_billing_payments_on_deleted_at' AND type='index'
3228
+ UNION ALL
3229
+ SELECT sql
3230
+ FROM sqlite_temp_master
3231
+ WHERE name='index_billing_payments_on_deleted_at' AND type='index'
3232
+ 
3233
+  (0.1ms) SELECT sql
3234
+ FROM sqlite_master
3235
+ WHERE name='index_billing_plus_on_department_id' AND type='index'
3236
+ UNION ALL
3237
+ SELECT sql
3238
+ FROM sqlite_temp_master
3239
+ WHERE name='index_billing_plus_on_department_id' AND type='index'
3240
+
3241
+  (0.1ms)  SELECT sql
3242
+ FROM sqlite_master
3243
+ WHERE name='index_billing_plus_on_tax_group_id' AND type='index'
3244
+ UNION ALL
3245
+ SELECT sql
3246
+ FROM sqlite_temp_master
3247
+ WHERE name='index_billing_plus_on_tax_group_id' AND type='index'
3248
+ 
3249
+  (0.1ms) SELECT sql
3250
+ FROM sqlite_master
3251
+ WHERE name='index_billing_pt_fp_mappings_on_payment_type_id' AND type='index'
3252
+ UNION ALL
3253
+ SELECT sql
3254
+ FROM sqlite_temp_master
3255
+ WHERE name='index_billing_pt_fp_mappings_on_payment_type_id' AND type='index'
3256
+
3257
+  (0.1ms)  SELECT sql
3258
+ FROM sqlite_master
3259
+ WHERE name='index_billing_pt_fp_mappings_on_extface_driver_id' AND type='index'
3260
+ UNION ALL
3261
+ SELECT sql
3262
+ FROM sqlite_temp_master
3263
+ WHERE name='index_billing_pt_fp_mappings_on_extface_driver_id' AND type='index'
3264
+ 
3265
+  (0.1ms) SELECT sql
3266
+ FROM sqlite_master
3267
+ WHERE name='index_billing_reports_on_origin_id' AND type='index'
3268
+ UNION ALL
3269
+ SELECT sql
3270
+ FROM sqlite_temp_master
3271
+ WHERE name='index_billing_reports_on_origin_id' AND type='index'
3272
+
3273
+  (0.1ms)  SELECT sql
3274
+ FROM sqlite_master
3275
+ WHERE name='index_billing_tg_fp_mappings_on_tax_group_id' AND type='index'
3276
+ UNION ALL
3277
+ SELECT sql
3278
+ FROM sqlite_temp_master
3279
+ WHERE name='index_billing_tg_fp_mappings_on_tax_group_id' AND type='index'
3280
+ 
3281
+  (0.1ms) SELECT sql
3282
+ FROM sqlite_master
3283
+ WHERE name='index_billing_tg_fp_mappings_on_extface_driver_id' AND type='index'
3284
+ UNION ALL
3285
+ SELECT sql
3286
+ FROM sqlite_temp_master
3287
+ WHERE name='index_billing_tg_fp_mappings_on_extface_driver_id' AND type='index'
3288
+
3289
+  (0.1ms)  SELECT sql
3290
+ FROM sqlite_master
3291
+ WHERE name='index_billing_versions_on_item_type_and_item_id' AND type='index'
3292
+ UNION ALL
3293
+ SELECT sql
3294
+ FROM sqlite_temp_master
3295
+ WHERE name='index_billing_versions_on_item_type_and_item_id' AND type='index'
2812
3296