billing 0.0.3 → 0.0.4a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/billing/account.rb +84 -6
  3. data/app/models/billing/charge.rb +15 -0
  4. data/app/models/billing/department.rb +5 -0
  5. data/app/models/billing/modifier.rb +3 -1
  6. data/app/models/billing/operator.rb +4 -0
  7. data/app/models/billing/origin.rb +13 -0
  8. data/app/models/billing/payment.rb +49 -20
  9. data/app/models/billing/payment_external.rb +8 -0
  10. data/app/models/billing/payment_type.rb +3 -1
  11. data/app/models/billing/payment_type_fiscal_driver_mapping.rb +7 -0
  12. data/app/models/billing/payment_with_type.rb +18 -2
  13. data/app/models/billing/paypal_express.rb +7 -0
  14. data/app/models/billing/report.rb +66 -0
  15. data/app/models/billing/version.rb +5 -0
  16. data/app/models/{billing → concerns/billing}/account_item.rb +5 -2
  17. data/config/initializers/paper_trail.rb +3 -0
  18. data/db/migrate/20140721172932_create_billing_operators.rb +11 -0
  19. data/db/migrate/20140721173106_create_billing_departments.rb +12 -0
  20. data/db/migrate/20140722160242_change_table_base_billing_tax_group.rb +12 -0
  21. data/db/migrate/20140722160258_change_table_base_billing_operator.rb +9 -0
  22. data/db/migrate/20140722160529_change_table_base_billing_payment_type.rb +10 -0
  23. data/db/migrate/20140722160902_change_table_base_billing_departments.rb +10 -0
  24. data/db/migrate/20140722161743_change_table_base_billing_plus.rb +15 -0
  25. data/db/migrate/20140722162315_change_table_base_billing_origins.rb +13 -0
  26. data/db/migrate/20140724173527_add_origin_to_billing_account.rb +7 -0
  27. data/db/migrate/20140724173917_remove_origin_and_fiscal_defice_from_billing_payment.rb +6 -0
  28. data/db/migrate/20140725122914_add_status_to_billing_payment.rb +5 -0
  29. data/db/migrate/20140725142525_eqalize_schemas_billing_charge.rb +16 -0
  30. data/db/migrate/20140725143734_eqalize_schemas_billing_department.rb +5 -0
  31. data/db/migrate/20140725145640_eqalize_schemas_billing_closure.rb +25 -0
  32. data/db/migrate/20140725145953_eqalize_schemas_billing_operators.rb +5 -0
  33. data/db/migrate/20140725150329_eqalize_schemas_billing_origin.rb +5 -0
  34. data/db/migrate/20140725151522_eqalize_schemas_billing_payment_type.rb +8 -0
  35. data/db/migrate/20140725152125_eqalize_schemas_billing_payment.rb +14 -0
  36. data/db/migrate/20140725153215_eqalize_schemas_billing_version.rb +16 -0
  37. data/db/migrate/20140725153658_eqalize_schemas_billing_pt_fp_mapping.rb +14 -0
  38. data/db/migrate/20140725164847_add_extface_job_to_billing_account.rb +5 -0
  39. data/db/migrate/20140726163220_rename_closure_to_billing_report.rb +5 -0
  40. data/db/migrate/20140726165718_remove_closure_from_billing_account.rb +6 -0
  41. data/db/migrate/20140726170002_add_report_to_billing_account.rb +5 -0
  42. data/db/migrate/20140728110230_add_autofin_and_finalized_at_to_billing_account.rb +6 -0
  43. data/db/migrate/20140729083050_add_name_to_billing_account.rb +5 -0
  44. data/db/migrate/20140729083408_add_number_to_billing_account.rb +5 -0
  45. data/db/migrate/20140729180849_add_deleted_at_to_billing_modifier.rb +5 -0
  46. data/db/migrate/20140729182146_add_deleted_at_to_billing_account.rb +5 -0
  47. data/lib/billing/billable.rb +6 -2
  48. data/lib/billing/engine.rb +1 -0
  49. data/lib/billing/version.rb +1 -1
  50. data/test/dummy/db/development.sqlite3 +0 -0
  51. data/test/dummy/db/schema.rb +139 -1
  52. data/test/dummy/db/test.sqlite3 +0 -0
  53. data/test/dummy/log/development.log +5698 -0
  54. data/test/dummy/log/test.log +63958 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/0cab887466527f5353fd43adab72769b +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/79316f9f3f5ebcec9b368d92d2e97e23 +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/d3ab844c61f1c211ed5fad5407cd18ef +0 -0
  58. data/test/fixtures/billing/accounts.yml +2 -0
  59. data/test/fixtures/billing/departments.yml +11 -0
  60. data/test/fixtures/billing/modifiers.yml +1 -0
  61. data/test/fixtures/billing/operators.yml +11 -0
  62. data/test/fixtures/billing/origins.yml +2 -0
  63. data/test/fixtures/billing/payment_types.yml +16 -0
  64. data/test/fixtures/billing/payments.yml +5 -1
  65. data/test/models/billing/account_test.rb +19 -6
  66. data/test/models/billing/department_test.rb +9 -0
  67. data/test/models/billing/modifier_test.rb +13 -0
  68. data/test/models/billing/operator_test.rb +9 -0
  69. data/test/models/billing/payment_test.rb +25 -0
  70. metadata +64 -6
  71. data/app/assets/javascripts/billing/payments.js +0 -2
@@ -0,0 +1,5 @@
1
+ module Billing
2
+ class Version < PaperTrail::Version
3
+ self.table_name = :billing_versions
4
+ end
5
+ end
@@ -3,9 +3,12 @@ module Billing
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- #belongs_to :account
7
-
6
+ acts_as_paranoid if respond_to?(:acts_as_paranoid)
7
+ has_paper_trail class_name: 'Billing::Version' if respond_to?(:has_paper_trail)
8
+
8
9
  delegate :save, to: :account, prefix: :account
10
+ delegate :origins, :payment_types, to: :account
11
+
9
12
  after_save :account_save
10
13
 
11
14
  validates_presence_of :account
@@ -0,0 +1,3 @@
1
+ PaperTrail::Version.module_eval do
2
+ self.abstract_class = true
3
+ end
@@ -0,0 +1,11 @@
1
+ class CreateBillingOperators < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_operators do |t|
4
+ t.integer :master_id
5
+ t.string :name
6
+ t.string :type
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBillingDepartments < ActiveRecord::Migration
2
+ def change
3
+ create_table :billing_departments do |t|
4
+ t.integer :master_id
5
+ t.string :name
6
+ t.integer :tax_group_id
7
+ t.string :type
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class ChangeTableBaseBillingTaxGroup < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_tax_groups do |t|
4
+ t.integer :master_id
5
+ t.integer :number
6
+ t.decimal :percent_ratio, precision: 6, scale: 3
7
+ t.boolean :banned
8
+ t.string :type
9
+ t.timestamp :deleted_at
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class ChangeTableBaseBillingOperator < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_operators do |t|
4
+ t.integer :number
5
+ t.boolean :banned
6
+ t.timestamp :deleted_at
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class ChangeTableBaseBillingPaymentType < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_payment_types do |t|
4
+ t.integer :master_id
5
+ t.integer :number
6
+ t.boolean :banned
7
+ t.timestamp :deleted_at
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class ChangeTableBaseBillingDepartments < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_departments do |t|
4
+ t.integer :number
5
+ t.boolean :banned
6
+ t.timestamp :deleted_at
7
+ end
8
+ add_index :billing_departments, :tax_group_id
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ class ChangeTableBaseBillingPlus < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_plus do |t|
4
+ t.integer :master_id
5
+ t.belongs_to :tax_group, index: true
6
+ t.belongs_to :department, index: true
7
+ t.integer :number
8
+ t.money :price
9
+ t.string :code
10
+ t.string :type
11
+ t.boolean :banned
12
+ t.timestamp :deleted_at
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class ChangeTableBaseBillingOrigins < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_origins do |t|
4
+ t.integer :master_id
5
+ t.integer :fiscal_device_id
6
+ t.boolean :banned
7
+ t.timestamp :deleted_at
8
+ t.string :type
9
+ t.string :payment_model, default: 'Billing::PaymentWithType'
10
+ end
11
+ add_index :billing_origins, :fiscal_device_id
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ class AddOriginToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_accounts do |t|
4
+ t.belongs_to :origin, index: true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveOriginAndFiscalDeficeFromBillingPayment < ActiveRecord::Migration
2
+ def change
3
+ remove_column :billing_payments, :origin_id, :integer
4
+ remove_column :billing_payments, :fiscal_device_id, :integer
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddStatusToBillingPayment < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_payments, :status, :string
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ class EqalizeSchemasBillingCharge < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_charges do |t|
4
+ t.string :name
5
+ t.string :description
6
+ t.belongs_to :origin
7
+ t.money :value
8
+ t.timestamp :deleted_at
9
+ t.timestamp :revenue_at
10
+ end
11
+
12
+ add_index :billing_charges, :origin_id
13
+ add_index :billing_charges, :deleted_at
14
+ add_index :billing_charges, :revenue_at
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ class EqalizeSchemasBillingDepartment < ActiveRecord::Migration
2
+ def change
3
+ add_index :billing_departments, :deleted_at
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ class EqalizeSchemasBillingClosure < ActiveRecord::Migration
2
+ def change
3
+ create_table "billing_closures", force: true do |t|
4
+ t.integer "master_id"
5
+ t.integer "origin_id"
6
+ t.integer "payments_sum_cents", default: 0, null: false
7
+ t.string "payments_sum_currency", default: "USD", null: false
8
+ t.integer "payments_cash_cents", default: 0, null: false
9
+ t.string "payments_cash_currency", default: "USD", null: false
10
+ t.integer "payments_fiscal_cents", default: 0, null: false
11
+ t.string "payments_fiscal_currency", default: "USD", null: false
12
+ t.text "note"
13
+ t.string "type"
14
+ t.datetime "created_at"
15
+ t.datetime "updated_at"
16
+ t.integer "extface_job_id"
17
+ t.date "f_period_from"
18
+ t.date "f_period_to"
19
+ t.boolean "zeroing"
20
+ t.string "f_operation"
21
+ end
22
+
23
+ add_index "billing_closures", ["origin_id"], name: "index_billing_closures_on_origin_id"
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ class EqalizeSchemasBillingOperators < ActiveRecord::Migration
2
+ def change
3
+ add_index :billing_operators, :deleted_at
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class EqalizeSchemasBillingOrigin < ActiveRecord::Migration
2
+ def change
3
+ add_index :billing_origins, :deleted_at
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class EqalizeSchemasBillingPaymentType < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_payment_types do |t|
4
+ t.boolean :print_copy
5
+ end
6
+ add_index :billing_payment_types, :deleted_at
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ class EqalizeSchemasBillingPayment < ActiveRecord::Migration
2
+ def change
3
+ change_table :billing_payments do |t|
4
+ t.string :name
5
+ t.string :description
6
+ t.string :external_token
7
+ t.string :note
8
+ t.integer :closure_id
9
+ t.timestamp :deleted_at
10
+ end
11
+ add_index :billing_payments, :deleted_at
12
+ add_index :billing_payments, :closure_id
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ class EqalizeSchemasBillingVersion < ActiveRecord::Migration
2
+ def change
3
+ create_table "billing_versions", force: true do |t|
4
+ t.string "item_type", null: false
5
+ t.integer "item_id", null: false
6
+ t.string "event", null: false
7
+ t.string "whodunnit"
8
+ t.text "object"
9
+ t.datetime "created_at"
10
+ t.string "ip"
11
+ t.string "user_agent"
12
+ end
13
+
14
+ add_index "billing_versions", ["item_type", "item_id"], name: "index_billing_versions_on_item_type_and_item_id"
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ class EqalizeSchemasBillingPtFpMapping < ActiveRecord::Migration
2
+ def change
3
+ create_table "billing_pt_fp_mappings", force: true do |t|
4
+ t.integer "payment_type_id"
5
+ t.integer "extface_driver_id"
6
+ t.integer "mapping"
7
+ t.datetime "created_at"
8
+ t.datetime "updated_at"
9
+ end
10
+
11
+ add_index "billing_pt_fp_mappings", ["extface_driver_id"], name: "index_billing_pt_fp_mappings_on_extface_driver_id"
12
+ add_index "billing_pt_fp_mappings", ["payment_type_id"], name: "index_billing_pt_fp_mappings_on_payment_type_id"
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddExtfaceJobToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_reference :billing_accounts, :extface_job, index: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class RenameClosureToBillingReport < ActiveRecord::Migration
2
+ def change
3
+ rename_table :billing_closures, :billing_reports
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveClosureFromBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ remove_index :billing_payments, :closure_id
4
+ remove_column :billing_payments, :closure_id, :integer
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddReportToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_reference :billing_accounts, :report, index: true
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddAutofinAndFinalizedAtToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_accounts, :autofin, :boolean, default: true
4
+ add_column :billing_accounts, :finalized_at, :timestamp
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddNameToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_accounts, :name, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddNumberToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_accounts, :number, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDeletedAtToBillingModifier < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_modifiers, :deleted_at, :timestamp, index: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDeletedAtToBillingAccount < ActiveRecord::Migration
2
+ def change
3
+ add_column :billing_accounts, :deleted_at, :timestamp, index: true
4
+ end
5
+ end
@@ -16,8 +16,12 @@ module Billing
16
16
  provide_billing_items(options[:as])
17
17
  end
18
18
  if payment_types_scope.present?
19
- define_method :billing_payment_types do
20
- payment_types_scope
19
+ if payment_types_scope.respond_to? :scope
20
+ define_method :billing_payment_types do
21
+ payment_types_scope
22
+ end
23
+ else
24
+ alias_method :billing_payment_types, payment_types_scope.intern
21
25
  end
22
26
  end
23
27
  end
@@ -1,4 +1,5 @@
1
1
  require 'money-rails'
2
+ require 'paper_trail'
2
3
  module Billing
3
4
  class Engine < ::Rails::Engine
4
5
  isolate_namespace Billing
@@ -1,3 +1,3 @@
1
1
  module Billing
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4a"
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: 20140720132559) do
14
+ ActiveRecord::Schema.define(version: 20140729182146) do
15
15
 
16
16
  create_table "billing_accounts", force: true do |t|
17
17
  t.integer "billable_id"
@@ -30,9 +30,20 @@ ActiveRecord::Schema.define(version: 20140720132559) do
30
30
  t.string "balance_currency", default: "USD", null: false
31
31
  t.integer "surcharges_sum_cents", default: 0, null: false
32
32
  t.string "surcharges_sum_currency", default: "USD", null: false
33
+ t.integer "origin_id"
34
+ t.integer "extface_job_id"
35
+ t.integer "report_id"
36
+ t.boolean "autofin", default: true
37
+ t.datetime "finalized_at"
38
+ t.string "name"
39
+ t.string "number"
40
+ t.datetime "deleted_at"
33
41
  end
34
42
 
35
43
  add_index "billing_accounts", ["billable_id", "billable_type"], name: "index_billing_accounts_on_billable_id_and_billable_type"
44
+ add_index "billing_accounts", ["extface_job_id"], name: "index_billing_accounts_on_extface_job_id"
45
+ add_index "billing_accounts", ["origin_id"], name: "index_billing_accounts_on_origin_id"
46
+ add_index "billing_accounts", ["report_id"], name: "index_billing_accounts_on_report_id"
36
47
 
37
48
  create_table "billing_charges", force: true do |t|
38
49
  t.integer "account_id"
@@ -42,10 +53,35 @@ ActiveRecord::Schema.define(version: 20140720132559) do
42
53
  t.string "price_currency", default: "USD", null: false
43
54
  t.datetime "created_at"
44
55
  t.datetime "updated_at"
56
+ t.string "name"
57
+ t.string "description"
58
+ t.integer "origin_id"
59
+ t.integer "value_cents", default: 0, null: false
60
+ t.string "value_currency", default: "USD", null: false
61
+ t.datetime "deleted_at"
62
+ t.datetime "revenue_at"
45
63
  end
46
64
 
47
65
  add_index "billing_charges", ["account_id"], name: "index_billing_charges_on_account_id"
48
66
  add_index "billing_charges", ["chargable_id", "chargable_type"], name: "index_billing_charges_on_chargable_id_and_chargable_type"
67
+ add_index "billing_charges", ["deleted_at"], name: "index_billing_charges_on_deleted_at"
68
+ add_index "billing_charges", ["origin_id"], name: "index_billing_charges_on_origin_id"
69
+ add_index "billing_charges", ["revenue_at"], name: "index_billing_charges_on_revenue_at"
70
+
71
+ create_table "billing_departments", force: true do |t|
72
+ t.integer "master_id"
73
+ t.string "name"
74
+ t.integer "tax_group_id"
75
+ t.string "type"
76
+ t.datetime "created_at"
77
+ t.datetime "updated_at"
78
+ t.integer "number"
79
+ t.boolean "banned"
80
+ t.datetime "deleted_at"
81
+ end
82
+
83
+ add_index "billing_departments", ["deleted_at"], name: "index_billing_departments_on_deleted_at"
84
+ add_index "billing_departments", ["tax_group_id"], name: "index_billing_departments_on_tax_group_id"
49
85
 
50
86
  create_table "billing_modifiers", force: true do |t|
51
87
  t.integer "account_id"
@@ -55,16 +91,39 @@ ActiveRecord::Schema.define(version: 20140720132559) do
55
91
  t.datetime "updated_at"
56
92
  t.integer "fixed_value_cents", default: 0, null: false
57
93
  t.string "fixed_value_currency", default: "USD", null: false
94
+ t.datetime "deleted_at"
58
95
  end
59
96
 
60
97
  add_index "billing_modifiers", ["account_id"], name: "index_billing_modifiers_on_account_id"
61
98
 
99
+ create_table "billing_operators", force: true do |t|
100
+ t.integer "master_id"
101
+ t.string "name"
102
+ t.string "type"
103
+ t.datetime "created_at"
104
+ t.datetime "updated_at"
105
+ t.integer "number"
106
+ t.boolean "banned"
107
+ t.datetime "deleted_at"
108
+ end
109
+
110
+ add_index "billing_operators", ["deleted_at"], name: "index_billing_operators_on_deleted_at"
111
+
62
112
  create_table "billing_origins", force: true do |t|
63
113
  t.string "name"
64
114
  t.datetime "created_at"
65
115
  t.datetime "updated_at"
116
+ t.integer "master_id"
117
+ t.integer "fiscal_device_id"
118
+ t.boolean "banned"
119
+ t.datetime "deleted_at"
120
+ t.string "type"
121
+ t.string "payment_model", default: "Billing::PaymentWithType"
66
122
  end
67
123
 
124
+ add_index "billing_origins", ["deleted_at"], name: "index_billing_origins_on_deleted_at"
125
+ add_index "billing_origins", ["fiscal_device_id"], name: "index_billing_origins_on_fiscal_device_id"
126
+
68
127
  create_table "billing_payment_types", force: true do |t|
69
128
  t.string "name"
70
129
  t.boolean "cash"
@@ -72,8 +131,15 @@ ActiveRecord::Schema.define(version: 20140720132559) do
72
131
  t.datetime "created_at"
73
132
  t.datetime "updated_at"
74
133
  t.string "type"
134
+ t.integer "master_id"
135
+ t.integer "number"
136
+ t.boolean "banned"
137
+ t.datetime "deleted_at"
138
+ t.boolean "print_copy"
75
139
  end
76
140
 
141
+ add_index "billing_payment_types", ["deleted_at"], name: "index_billing_payment_types_on_deleted_at"
142
+
77
143
  create_table "billing_payments", force: true do |t|
78
144
  t.integer "account_id"
79
145
  t.integer "value_cents", default: 0, null: false
@@ -82,28 +148,100 @@ ActiveRecord::Schema.define(version: 20140720132559) do
82
148
  t.datetime "updated_at"
83
149
  t.string "type"
84
150
  t.integer "payment_type_id"
151
+ t.string "status"
152
+ t.string "name"
153
+ t.string "description"
154
+ t.string "external_token"
155
+ t.string "note"
156
+ t.datetime "deleted_at"
85
157
  end
86
158
 
87
159
  add_index "billing_payments", ["account_id"], name: "index_billing_payments_on_account_id"
160
+ add_index "billing_payments", ["deleted_at"], name: "index_billing_payments_on_deleted_at"
88
161
 
89
162
  create_table "billing_plus", force: true do |t|
90
163
  t.string "name"
91
164
  t.datetime "created_at"
92
165
  t.datetime "updated_at"
166
+ t.integer "master_id"
167
+ t.integer "tax_group_id"
168
+ t.integer "department_id"
169
+ t.integer "number"
170
+ t.integer "price_cents", default: 0, null: false
171
+ t.string "price_currency", default: "USD", null: false
172
+ t.string "code"
173
+ t.string "type"
174
+ t.boolean "banned"
175
+ t.datetime "deleted_at"
93
176
  end
94
177
 
178
+ add_index "billing_plus", ["department_id"], name: "index_billing_plus_on_department_id"
179
+ add_index "billing_plus", ["tax_group_id"], name: "index_billing_plus_on_tax_group_id"
180
+
95
181
  create_table "billing_profiles", force: true do |t|
96
182
  t.string "name"
97
183
  t.datetime "created_at"
98
184
  t.datetime "updated_at"
99
185
  end
100
186
 
187
+ create_table "billing_pt_fp_mappings", force: true do |t|
188
+ t.integer "payment_type_id"
189
+ t.integer "extface_driver_id"
190
+ t.integer "mapping"
191
+ t.datetime "created_at"
192
+ t.datetime "updated_at"
193
+ end
194
+
195
+ add_index "billing_pt_fp_mappings", ["extface_driver_id"], name: "index_billing_pt_fp_mappings_on_extface_driver_id"
196
+ add_index "billing_pt_fp_mappings", ["payment_type_id"], name: "index_billing_pt_fp_mappings_on_payment_type_id"
197
+
198
+ create_table "billing_reports", force: true do |t|
199
+ t.integer "master_id"
200
+ t.integer "origin_id"
201
+ t.integer "payments_sum_cents", default: 0, null: false
202
+ t.string "payments_sum_currency", default: "USD", null: false
203
+ t.integer "payments_cash_cents", default: 0, null: false
204
+ t.string "payments_cash_currency", default: "USD", null: false
205
+ t.integer "payments_fiscal_cents", default: 0, null: false
206
+ t.string "payments_fiscal_currency", default: "USD", null: false
207
+ t.text "note"
208
+ t.string "type"
209
+ t.datetime "created_at"
210
+ t.datetime "updated_at"
211
+ t.integer "extface_job_id"
212
+ t.date "f_period_from"
213
+ t.date "f_period_to"
214
+ t.boolean "zeroing"
215
+ t.string "f_operation"
216
+ end
217
+
218
+ add_index "billing_reports", ["origin_id"], name: "index_billing_reports_on_origin_id"
219
+
101
220
  create_table "billing_tax_groups", force: true do |t|
102
221
  t.string "name"
103
222
  t.datetime "created_at"
104
223
  t.datetime "updated_at"
224
+ t.integer "master_id"
225
+ t.integer "number"
226
+ t.decimal "percent_ratio", precision: 6, scale: 3
227
+ t.boolean "banned"
228
+ t.string "type"
229
+ t.datetime "deleted_at"
105
230
  end
106
231
 
232
+ create_table "billing_versions", force: true do |t|
233
+ t.string "item_type", null: false
234
+ t.integer "item_id", null: false
235
+ t.string "event", null: false
236
+ t.string "whodunnit"
237
+ t.text "object"
238
+ t.datetime "created_at"
239
+ t.string "ip"
240
+ t.string "user_agent"
241
+ end
242
+
243
+ add_index "billing_versions", ["item_type", "item_id"], name: "index_billing_versions_on_item_type_and_item_id"
244
+
107
245
  create_table "profiles", force: true do |t|
108
246
  t.datetime "created_at"
109
247
  t.datetime "updated_at"