invoicing_payments_processing 1.1.54 → 1.1.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/balance.rb +15 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed522b59c5d199f4304b6f8f0a67d53402653d0e
4
- data.tar.gz: b0e657864ba63e02298a5b867ca7b01c2093c721
3
+ metadata.gz: 1294cf94b7e332d6ef0444b22134b388188e647e
4
+ data.tar.gz: 6351ac02e50156091d71ad80a3d3966247900d6d
5
5
  SHA512:
6
- metadata.gz: 1de7badcf5dc5d5f8065564b57369417a8510086de4f16904cfdd886f83d33ffdc59f26574adf0b352cec4f7b0d402bd46f716a6523799be81df2a9294e9e4f5
7
- data.tar.gz: da28758cc4d633a73fb9abf63cfe743a3f5dc4da7c0a633a2831e3c6f433d7ee1df225f70487afe23a0cfc7ecdee10dd475884d1cd8b1c86416287804384212d
6
+ metadata.gz: e0d92dba76c788bc2bd44012d55df5939290b06eb6559954dd11dcd6901dc30945a781215db9bd3e1b95b6e9b785b7012f72dbde057c2a555cf34f1b8a4c8c63
7
+ data.tar.gz: c69783fc4a9433009feaaa33feefc279e9c1e4acae1cb2ca70efb18c566d3780c7b43f6c0f341a3821671bdc17ce63e857d0fc7d556b930245abe4eb7801c618
@@ -10,14 +10,21 @@ module BlackStack
10
10
  end
11
11
 
12
12
  def calculate()
13
- q =
14
- "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
15
- "from movement with (nolock index(IX_movement__id_client__product_code)) " +
16
- "where id_client='#{self.client.id}' " +
17
- "and product_code='#{self.product_code}' "
18
-
19
- q += "and create_time < '#{self.up_time.to_time.to_sql}' " if !self.up_time.nil?
20
-
13
+ if !self.up_time.nil?
14
+ q =
15
+ "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
16
+ "from movement with (nolock) " +
17
+ "where id_client='#{self.client.id}' " +
18
+ "and product_code='#{self.product_code}' " +
19
+ "and create_time < '#{self.up_time.to_time.to_sql}' "
20
+ else
21
+ q =
22
+ "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
23
+ "from stat_balance x with (nolock) " +
24
+ "where x.id_client='#{self.client.id}' " +
25
+ "and x.product_code='#{self.product_code}' " +
26
+ end
27
+
21
28
  row = DB[q].first
22
29
  self.amount = row[:amount].to_f
23
30
  self.credits = row[:credits].to_f
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoicing_payments_processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.54
4
+ version: 1.1.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-01 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket