comee_core 0.3.48 → 0.3.50

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: 00f03dece5e306a3223e1f8d3b4f2bff270bca417d6d0acdc26e41f1f158b8bf
4
- data.tar.gz: dc7de7a9f4e7c54211b0bfd80787c27459c945181a8936f651aa763f8645491d
3
+ metadata.gz: ca617ef814088107f21ec7f2a8d541db9a58f2f8d60576aea6ef20370328a820
4
+ data.tar.gz: db91bf688f9d5a3479934a0839a3843e927a6b4a2b34e21ce11df5489478af37
5
5
  SHA512:
6
- metadata.gz: f40f1786625685b59dd60cb79cd9535dc6f72ee5eccbee66606424a7c60cb532aca082b78f2c742165957f79a69821378d9cf09c02bad540f3b6d8cfcd52633c
7
- data.tar.gz: 8492dc6005f3f19af459a0ddbe14b0943c5a395cfd24274e871088d5aa7a4b0ce65d39eb9d7263583f693d3c3b46700d9ecf6086c66c83fc813b83379d43a86a
6
+ metadata.gz: 60df1dd5ca85c8ae6b27e75d1aa5d3e30327b7366ad925a7c1443bc54e6e017064a88372d599e2d3b300c1cb17f10a8415c20dcbdb9823cb5e423792f2cda8c3
7
+ data.tar.gz: 8e696cdba2b0ead77fc9ecbb74c3bd1acf118b0221eee54cb047adbb4f272fbef6708857e8268c5dd5b83d1b501c3f5873bb8f3a5607f7efa90f24f69841a01c
@@ -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,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class PurchaseOrderItemSerializer < ActiveModel::Serializer
4
- attributes :id, :serial_no, :quantity, :confirmed_quantity, :price, :details
4
+ attributes :id, :serial_no, :quantity, :confirmed_quantity, :price, :details, :remark
5
5
 
6
6
  belongs_to :purchase_order
7
7
  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.48".freeze
3
+ VERSION = "0.3.50".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.48
4
+ version: 0.3.50
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