ecom_core 1.0.9 → 1.0.14

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
  SHA256:
3
- metadata.gz: 5b59b8dbf20e8f81cb6c76f89b92f1b0b120a9b487846039b5c2b476d177ea8a
4
- data.tar.gz: c254bb1490b4512d45f6add059f3e7a8685ccd571dca843e46e8a57c9c17b9fe
3
+ metadata.gz: 4bd257f6678b4a6d2d47ef80cd2748716388301e49b71af403d2822171486e12
4
+ data.tar.gz: 2a59d7ff332a8cad20eb48dab49ed92f7209f7211bd0fc2b0ce26fa565fe42b2
5
5
  SHA512:
6
- metadata.gz: 6fadd3b668c06009686cdbadf0b13933d7dba415ca4e825fbb68889d380ce2803832494583bec9ccc4ac1bea28f6df79ac1da211482cc9a9b88c3fa7c1f719f5
7
- data.tar.gz: ec05075973f8df540d177cb9ea188f2f68bdc7aa11250ffb164fc3bb3d9ac039df055a7251a52a54fda1c36166220ed1d3759a31e912a87bce256aaf986f4284
6
+ metadata.gz: b13fc4b2805f9d1b6459606bc672d2277ec41c8dc111269b29a89847383e845ecd7b22d265a7da697b7401c01d309898e655dd4fde2cab01b249fea6b9a4f61c
7
+ data.tar.gz: bb82c30965b9e6d2b81acc10c86c1171082fee2e3d8fdae3a9894caf4c180c4477edf5bdf53dfc0ff678ebecc615092f9548b87119b3e09e32531a3cf388889d
@@ -4,12 +4,19 @@ module Ecom
4
4
  PERMANENT = 'Permanent'.freeze
5
5
  TEMPORARY = 'Temporary'.freeze
6
6
 
7
+ before_save :set_employment_date,
8
+ if: proc { |c| c.employment_date.nil? }
9
+
7
10
  belongs_to :crew_type
8
11
 
9
12
  validates :name, :qualification, presence: true
10
13
  validates :employment, inclusion: [PERMANENT, TEMPORARY]
11
- validates :wage, presence: true, if: ->(o) { o.employment == PERMANENT }
12
- validates :wage, absence: true, if: ->(o) { o.employment == TEMPORARY }
14
+ #validates :wage, presence: true, if: ->(o) { o.employment == PERMANENT }
15
+ #validates :wage, absence: true, if: ->(o) { o.employment == TEMPORARY }
16
+
17
+ def set_employment_date
18
+ self.employment_date = Date.today
19
+ end
13
20
  end
14
21
  end
15
22
  end
@@ -0,0 +1,7 @@
1
+ module Ecom::Core
2
+ class Payment < ApplicationRecord
3
+ belongs_to :payroll
4
+ has_many :payment_details, class_name: 'Ecom::Core::PaymentDetail'
5
+ validates :from, :to, presence: true
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Ecom
2
+ module Core
3
+ class PaymentDetail < ApplicationRecord
4
+ belongs_to :crew
5
+ belongs_to :payment
6
+
7
+ validates :hours, :ot_hours, :base_salary, :overtime, :gross_salary, :tax, :pension, :net_salary, presence: true
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Ecom
2
+ module Core
3
+ class Payroll < ApplicationRecord
4
+ validates :month, :year, presence: true
5
+
6
+ has_many :payments, class_name: 'Ecom::Core::Payment'
7
+ end
8
+ end
9
+ end
@@ -7,6 +7,10 @@ class CreateEcomCoreCrews < ActiveRecord::Migration[6.0]
7
7
  t.string :qualification, null: false
8
8
  t.string :employment, null: false
9
9
  t.float :wage
10
+ t.date :employment_date
11
+ t.boolean :sub_contracted, null: false, default: false
12
+ t.string :guarantor_name
13
+ t.string :guarantor_phone
10
14
  t.boolean :active, null: false, default: true
11
15
  t.references :crew_type, index: { name: 'crew_on_ct_indx' }
12
16
 
@@ -5,7 +5,7 @@ class CreateEcomCoreCrewTimes < ActiveRecord::Migration[6.0]
5
5
  t.time :checkin_time
6
6
  t.time :checkout_time
7
7
  t.float :hours, null: false
8
- t.float :converted_hours, null: false
8
+ t.float :converted_hours, null: false, default: 0
9
9
  t.references :crew, index: { name: 'ct_on_crew_indx' }
10
10
  t.string :remark
11
11
  t.boolean :overtime, null: false, default: false
@@ -0,0 +1,11 @@
1
+ class CreateEcomCorePayrolls < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_core_payrolls do |t|
4
+ t.integer :month, null: false
5
+ t.integer :year, null: false
6
+ t.boolean :approved, null: false, default: false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateEcomCorePayments < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_core_payments do |t|
4
+ t.date :from, null: false
5
+ t.date :to, null: false
6
+ t.references :payroll, null: false, index: { name: 'payments_on_payroll_indx' }
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_foreign_key :ecom_core_payments, :ecom_core_payrolls, column: :payroll_id
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ class CreateEcomCorePaymentDetails < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_core_payment_details do |t|
4
+ t.float :hours, null: false
5
+ t.float :ot_hours, null: false, default: 0
6
+ t.float :base_salary, null: false
7
+ t.float :overtime, null: false, default: 0
8
+ t.float :gross_salary, null: false
9
+ t.float :tax, null: false, default: 0
10
+ t.float :pension, null: false, default: 0
11
+ t.float :net_salary, null: false
12
+ t.references :crew, null: false, index: { name: 'pd_on_crew_indx' }
13
+ t.references :payment, null: false, index: { name: 'pd_on_payment_indx' }
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ add_foreign_key :ecom_core_payment_details, :ecom_core_crews, column: :crew_id
19
+ add_foreign_key :ecom_core_payment_details, :ecom_core_payments, column: :payment_id
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Ecom
2
2
  module Core
3
- VERSION = '1.0.9'.freeze
3
+ VERSION = '1.0.14'.freeze
4
4
  end
5
5
  end
@@ -6,6 +6,10 @@ FactoryBot.define do
6
6
  qualification { FFaker::Name.name }
7
7
  employment { Ecom::Core::Crew::PERMANENT }
8
8
  wage { FFaker::Random.rand(1000..5000) }
9
+ employment_date { Date.today }
10
+ sub_contracted { false }
11
+ guarantor_name { FFaker::Name.name }
12
+ guarantor_phone { FFaker::Name.name }
9
13
  active { true }
10
14
 
11
15
  association :crew_type
@@ -0,0 +1,14 @@
1
+ FactoryBot.define do
2
+ factory :payment_detail, class: 'Ecom::Core::PaymentDetail' do
3
+ hours { 1.5 }
4
+ ot_hours { 1.5 }
5
+ base_salary { 1.5 }
6
+ overtime { 1.5 }
7
+ gross_salary { 1.5 }
8
+ tax { 1.5 }
9
+ pension { 1.5 }
10
+ net_salary { 1.5 }
11
+ association :crew
12
+ association :payment
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :payment, class: 'Ecom::Core::Payment' do
3
+ from { Date.parse('2000-01-01') }
4
+ to { Date.parse('2000-01-15') }
5
+ association :payroll
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :payroll, class: 'Ecom::Core::Payroll' do
3
+ month { 1 }
4
+ year { 2000 }
5
+ approved { false }
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecom_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-14 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm
@@ -206,6 +206,9 @@ files:
206
206
  - app/models/ecom/core/material_type.rb
207
207
  - app/models/ecom/core/menu.rb
208
208
  - app/models/ecom/core/overtime_type.rb
209
+ - app/models/ecom/core/payment.rb
210
+ - app/models/ecom/core/payment_detail.rb
211
+ - app/models/ecom/core/payroll.rb
209
212
  - app/models/ecom/core/product_type.rb
210
213
  - app/models/ecom/core/project.rb
211
214
  - app/models/ecom/core/resource_type.rb
@@ -246,6 +249,9 @@ files:
246
249
  - db/migrate/20191206104247_create_ecom_core_work_components.rb
247
250
  - db/migrate/20191225100054_create_ecom_core_crews.rb
248
251
  - db/migrate/20191225211712_create_ecom_core_crew_times.rb
252
+ - db/migrate/20200126081005_create_ecom_core_payrolls.rb
253
+ - db/migrate/20200126082103_create_ecom_core_payments.rb
254
+ - db/migrate/20200126183218_create_ecom_core_payment_details.rb
249
255
  - lib/ecom/core.rb
250
256
  - lib/ecom/core/engine.rb
251
257
  - lib/ecom/core/version.rb
@@ -261,6 +267,9 @@ files:
261
267
  - spec/factories/ecom/core/material_types.rb
262
268
  - spec/factories/ecom/core/menus.rb
263
269
  - spec/factories/ecom/core/overtime_types.rb
270
+ - spec/factories/ecom/core/payment_details.rb
271
+ - spec/factories/ecom/core/payments.rb
272
+ - spec/factories/ecom/core/payrolls.rb
264
273
  - spec/factories/ecom/core/product_types.rb
265
274
  - spec/factories/ecom/core/projects.rb
266
275
  - spec/factories/ecom/core/resource_types.rb