invoicing_payments_processing 1.1.51 → 1.1.56

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
  SHA1:
3
- metadata.gz: 624069067ef76f9401f22e552151eb438e6d82f9
4
- data.tar.gz: 3d628ef7f38ef8d9a0810295393df5673ebcb2d4
3
+ metadata.gz: bbf8d14ab09274cca1347069880dd42704276aa6
4
+ data.tar.gz: fe4f4472a6e138fc6d5763bf1f3d10cfa5dfffa4
5
5
  SHA512:
6
- metadata.gz: dc95fb5484a6809daa6df41676dcae565378f4f8cdaf1db0de386a954b0cc5484c458f34205583230120fbfa131fb4a28181383987b89e76ea86bf36a610fbed
7
- data.tar.gz: f446b933246ea93c568826197ea3c3f00dc7dc176817cc125e4948038b12e967ec52c783eb95a0418d092a245aaf146daa89d2f3615572fbb389bd90d27600e5
6
+ metadata.gz: 0cf1c203a98b89cb889b6f3b81cda659a72ff25eef71b1c00797f7233bfff1908d119dde2bf3bf656395db258de309a96824b1eef205482f5ce7239a67f7a510
7
+ data.tar.gz: beb36ff2205f605672c8905362feff35c42642f2390c12c95959a9a84bd0da3a698109928f32c0882e1f63b12420ba387e6f3fb3ad3fd6954afb8abf3db0eb66
@@ -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
@@ -48,19 +48,21 @@ puts "self.invoice:#{self.invoice.to_s}:."
48
48
  # obtengo el cliente que machea con este perfil
49
49
  c = nil
50
50
  if c.nil?
51
- puts 'a'
52
51
  if self.invoice.guid?
53
- puts 'b'
54
52
  i = BlackStack::Invoice.where(:id=>self.invoice).first
55
53
  c = i.client if !i.nil?
56
54
  end
57
55
  end
58
56
  if c.nil?
59
- puts 'c'
57
+ iid = self.invoice.split(".").last.to_s
58
+ if iid.guid?
59
+ i = BlackStack::Invoice.where(:id=>iid).first
60
+ c = i.client if !i.nil?
61
+ end
62
+ end
63
+ if c.nil?
60
64
  cid = self.invoice.split(".").first.to_s
61
- puts "c:#{cid}:."
62
65
  if cid.guid?
63
- puts 'd'
64
66
  c = BlackStack::Client.where(:id=>cid).first
65
67
  end
66
68
  end
@@ -353,7 +355,7 @@ puts 'd'
353
355
  s.save
354
356
 
355
357
  # obtengo la factura que se creo con esta suscripcion
356
- i = BlackStack::Invoice.where(:id=>b.invoice).first
358
+ i = BlackStack::Invoice.where(:id=>b.invoice.split(".").last.to_s).first
357
359
 
358
360
  # vinculo esta suscripcion a la factura que la genero, y a todas las facturas siguientes
359
361
  i.set_subscription(s)
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.51
4
+ version: 1.1.56
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