comee_core 0.3.49 → 0.3.51

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ee5aa8d7b6d61bb8af51da85a51ba665afb0514afa5368a7d694555d6fca5d4
4
- data.tar.gz: 4f8532f6d053cf07deecfaaea04b905562c2ba6f31f8c11b50ab60a9f1baba05
3
+ metadata.gz: 7eb8daaf5bd10966f39faab024fbac053cceea0b8975cc62f529340daba65bad
4
+ data.tar.gz: f82a270166be12621e18d5834aad45224bc2a1e0c7eb6464f668855e87792846
5
5
  SHA512:
6
- metadata.gz: 7c4a4a8ff3dfc63ddc159a0ddaae7b556fbed4fa306a4a5372a0f1e95163f49f1f711ca4fc4105f16f8a65033ecabc8ec0c6e36d6ff4fa46988eb6166806b380
7
- data.tar.gz: 9520888d27d0f66b985514f5499f0aa9dd70240aae8356088fb04bb515e93fdcd008b93afcf6636a4e65d398749c2c120b550ae3e45fe3f4e611ad6808aa7555
6
+ metadata.gz: cba8ba7756560f47bec8270a9e6b269ac4f106946589a8255d67be7e26e0f736fb1686c9d122c629c038950d254b840ffa7cfb45e11740ccdd29a36e028cc7f6
7
+ data.tar.gz: 99771a09d9f65b282a532c1691beb57d11d846c2c8c37e5fae5b6b7089db64b57e3b67721fb82c3eb1ed0d924499ec542afbb535884b51fd7f61c1eba15d7707
@@ -23,6 +23,11 @@ module Comee
23
23
  self.total_price = items.sum(&:total_price).round(2)
24
24
  end
25
25
 
26
+ def calculate_confirmed_total_price
27
+ items = PurchaseOrderItem.where(purchase_order_id: id)
28
+ self.confirmed_total_price = items.sum(&:confirmed_total_price).round(2)
29
+ end
30
+
26
31
  def calculate_vat
27
32
  return unless supplier.tax_code == "Inland"
28
33
 
@@ -31,6 +36,14 @@ module Comee
31
36
  self.vat = (total_price * 0.19).round(2)
32
37
  end
33
38
 
39
+ def calculate_confirmed_vat
40
+ return unless supplier.tax_code == "Inland"
41
+
42
+ items = PurchaseOrderItem.where(purchase_order_id: id)
43
+ confirmed_total_price = items.sum(&:confirmed_total_price)
44
+ self.confirmed_vat = (confirmed_total_price * 0.19).round(2)
45
+ end
46
+
34
47
  def self.ransackable_attributes(_auth_object = nil)
35
48
  %w[
36
49
  id
@@ -39,6 +39,8 @@ module Comee
39
39
  def update_purchase_order
40
40
  purchase_order.calculate_total_price
41
41
  purchase_order.calculate_vat
42
+ purchase_order.calculate_confirmed_total_price
43
+ purchase_order.calculate_confirmed_vat
42
44
  purchase_order.save!
43
45
  end
44
46
 
@@ -1,7 +1,8 @@
1
1
  module Comee
2
2
  module Core
3
3
  class PurchaseOrderItemSerializer < ActiveModel::Serializer
4
- attributes :id, :serial_no, :quantity, :confirmed_quantity, :price, :details, :remark
4
+ attributes :id, :serial_no, :purchase_order_id, :unit_id, :quantity, :confirmed_quantity, :price, :confirmed_price,
5
+ :total_price, :delivery_date, :confirmed_total_price, :confirmed_delivery_date, :status, :details, :remark
5
6
 
6
7
  belongs_to :purchase_order
7
8
  end
@@ -2,7 +2,7 @@ module Comee
2
2
  module Core
3
3
  class PurchaseOrderSerializer < ActiveModel::Serializer
4
4
  attributes :id, :po_number, :supplier_id, :order_date, :status, :delivery_address, :delivery_date, :terms, :total_price,
5
- :vat, :order_reference, :created_at, :updated_at
5
+ :vat, :order_reference, :created_at, :updated_at, :confirmed_total_price, :confirmed_vat
6
6
  belongs_to :supplier
7
7
  end
8
8
  end
@@ -0,0 +1,6 @@
1
+ class AddConfirmedFieldValuesToPurchaseOrder < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :comee_core_purchase_orders, :confirmed_total_price, :float, default: 0
4
+ add_column :comee_core_purchase_orders, :confirmed_vat, :float, default: 0
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.3.49".freeze
3
+ VERSION = "0.3.51".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.49
4
+ version: 0.3.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -540,6 +540,7 @@ files:
540
540
  - db/migrate/20240805093326_update_details_column_in_shipment_instruction_items.rb
541
541
  - db/migrate/20240807050230_add_amount_credited_to_invoice.rb
542
542
  - db/migrate/20240814125757_add_details_field_to_purchase_order_item.rb
543
+ - db/migrate/20240815080137_add_confirmed_field_values_to_purchase_order.rb
543
544
  - lib/comee/core.rb
544
545
  - lib/comee/core/engine.rb
545
546
  - lib/comee/core/version.rb