invoicing_payments_processing 1.1.59 → 1.1.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/balance.rb +2 -2
- data/lib/extend_client_by_invoicing_payments_processing.rb +1 -1
- data/lib/movement.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa3e73d17b05d75e69025d7364460ee6045a46cb
|
4
|
+
data.tar.gz: 2579bdc5324a9288e41fa92c9f2f84048f0c27f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3138f3c9a4721c504eba4376923717cf50af2382204020150d10fc480c3a6e536e6c09d7d56457d999aac9bcecf4b42388f2b686d91b5eb502291a4cbfed494
|
7
|
+
data.tar.gz: e3ef838af52b803608c1349a3e31b682afefb846716570e7fe38ee8070f73f96aaeecbf665b7b8d8641ae405b41859d60ccd43d1624c585ed5d2f6baa50e9074
|
data/lib/balance.rb
CHANGED
@@ -9,8 +9,8 @@ module BlackStack
|
|
9
9
|
self.calculate()
|
10
10
|
end
|
11
11
|
|
12
|
-
def calculate()
|
13
|
-
if !self.up_time.nil?
|
12
|
+
def calculate(use_stat_balance=true)
|
13
|
+
if !self.up_time.nil? || !use_stat_balance
|
14
14
|
q =
|
15
15
|
"select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
|
16
16
|
"from movement with (nolock) " +
|
@@ -28,7 +28,7 @@ module BlackStack
|
|
28
28
|
# update the table stat_balance with the amount and credits of this client, for each product.
|
29
29
|
def update_stat_balance(product_code=nil)
|
30
30
|
c = self
|
31
|
-
product_descriptors = BlackStack::InvoicingPaymentsProcessing::products_descriptor
|
31
|
+
product_descriptors = BlackStack::InvoicingPaymentsProcessing::products_descriptor.clone
|
32
32
|
product_descriptors.select! { |hprod| hprod[:code] == product_code } if !product_code.nil?
|
33
33
|
product_descriptors.each { |hprod|
|
34
34
|
row = DB[
|
data/lib/movement.rb
CHANGED
@@ -190,8 +190,10 @@ module BlackStack
|
|
190
190
|
self.expiration_tries = self.expiration_tries.to_i + 1
|
191
191
|
self.save
|
192
192
|
#
|
193
|
-
|
194
|
-
|
193
|
+
balance = BlackStack::Balance.new(self.client.id, self.product_code, registraton_time)
|
194
|
+
balance.calculate(false)
|
195
|
+
total_credits = 0.to_f - balance.credits.to_f
|
196
|
+
total_amount = 0.to_f - balance.amount.to_f
|
195
197
|
#
|
196
198
|
credits = 0.to_i - self.credits.to_i
|
197
199
|
#
|