abank 0.4.9 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/abank/big.rb +21 -12
- data/lib/abank/version.rb +1 -1
- data/lib/abank.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3bc90d0c9f03e14c34aa29f1074c8bd7e2a121eb787ed59cb38d31924e451142
|
|
4
|
+
data.tar.gz: ced118cd77e31d81076ca49dc1e9dcb4818f6084f622a8e1421540f335bfc40d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 857c60ec90b359cebe6f52430a09f26dfeaecb749d7b821412b2c10cae48263951274030bd4309e5050fe8aa7f512cc337ea30788af63750d1f6cfdf035fd256
|
|
7
|
+
data.tar.gz: c2df0dcc9476ef6255ce86266c600c3dee53e4177570e15bdb9af906426063fe8a376b50dbf8d3ffed58d84fd805a2f329268ddb441852aee69284b00ccb7f40
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
abank (0.
|
|
4
|
+
abank (0.5.1)
|
|
5
5
|
google-cloud-bigquery
|
|
6
6
|
roo
|
|
7
7
|
thor
|
|
@@ -110,7 +110,7 @@ GEM
|
|
|
110
110
|
racc (~> 1.4)
|
|
111
111
|
os (1.1.4)
|
|
112
112
|
parallel (1.26.3)
|
|
113
|
-
parser (3.3.
|
|
113
|
+
parser (3.3.7.0)
|
|
114
114
|
ast (~> 2.4.1)
|
|
115
115
|
racc
|
|
116
116
|
public_suffix (6.0.1)
|
data/lib/abank/big.rb
CHANGED
|
@@ -54,10 +54,8 @@ module Abank
|
|
|
54
54
|
@ctlct = []
|
|
55
55
|
unless mvkys.empty?
|
|
56
56
|
# obtem lista contratos arrendamento associados aos movimentos a apagar
|
|
57
|
-
@ctlct = sql("select distinct ct from #{BD}.
|
|
57
|
+
@ctlct = sql("select distinct ct from #{BD}.gmr where #{BD}.ky(dl,dv,ds,vl,nc) in(#{mvkys})")
|
|
58
58
|
|
|
59
|
-
# apaga todas as rendas dos contratos arrendamento associados aos movimentos a apagar
|
|
60
|
-
opcao[:t] = true unless ctlct.empty?
|
|
61
59
|
re_apaga.mv_delete_dml
|
|
62
60
|
end
|
|
63
61
|
self
|
|
@@ -71,9 +69,10 @@ module Abank
|
|
|
71
69
|
|
|
72
70
|
# (see CLI#tag)
|
|
73
71
|
def mv_classifica
|
|
74
|
-
|
|
72
|
+
@ctlct = []
|
|
73
|
+
stp("call #{BD}.uct()")
|
|
75
74
|
puts("MOVIMENTOS CLASSIFICADOS #{bqnrs}")
|
|
76
|
-
@ctlct = sql("select
|
|
75
|
+
@ctlct = sql("select ct from #{BD}.ca") if bqnrs.positive?
|
|
77
76
|
self
|
|
78
77
|
end
|
|
79
78
|
|
|
@@ -93,7 +92,7 @@ module Abank
|
|
|
93
92
|
# @return [Boolean] contrato arrendamento ja existe sim/nao?
|
|
94
93
|
def ct_existe?
|
|
95
94
|
@ctlct = [{ ct: opcao[:c] }]
|
|
96
|
-
vaz = sql("select ct from #{BD}.
|
|
95
|
+
vaz = sql("select ct from #{BD}.ca where ct in(#{str_lc})").empty?
|
|
97
96
|
unless vaz
|
|
98
97
|
@bqnrs = 1
|
|
99
98
|
puts('CONTRATO JA EXISTE')
|
|
@@ -147,14 +146,12 @@ module Abank
|
|
|
147
146
|
|
|
148
147
|
# @return [String] sql para obter ultima renda do contrato arrendamento
|
|
149
148
|
def sql_last_re
|
|
150
|
-
|
|
151
|
-
"from #{BD}.re r1 join hernanilr.ab.re r0 on (r0.ct=r1.ct and r0.cnt=0)"\
|
|
152
|
-
" where r1.ct='#{opcao[:c]}' order by r1.ano desc,r1.cnt desc limit 1"
|
|
149
|
+
"select * from #{BD}.glr where ct='#{opcao[:c]}' order by ano desc,cnt desc limit 1"
|
|
153
150
|
end
|
|
154
151
|
|
|
155
152
|
# @return [String] sql para obter movimentos novos (depois da ultima renda do contrato arrendamento)
|
|
156
153
|
def sql_novo_mv(mdl)
|
|
157
|
-
"select * from #{BD}.
|
|
154
|
+
"select * from #{BD}.gmn where ct='#{opcao[:c]}' and dl>='#{(mdl + 1).strftime(DF)}' order by 1,2"
|
|
158
155
|
end
|
|
159
156
|
|
|
160
157
|
# @return [String] sql para obter dados do inicio contrato arrendamento
|
|
@@ -172,7 +169,7 @@ module Abank
|
|
|
172
169
|
# (see CLI#recriare)
|
|
173
170
|
def re_atualiza
|
|
174
171
|
# [re]cria rendas novas/todas dos contratos ativos
|
|
175
|
-
@ctlct = sql("select
|
|
172
|
+
@ctlct = sql("select ct from #{BD}.ca")
|
|
176
173
|
re_apaga.ct_dados.re_insert
|
|
177
174
|
end
|
|
178
175
|
|
|
@@ -192,7 +189,7 @@ module Abank
|
|
|
192
189
|
#
|
|
193
190
|
# @return [Big] acesso a base dados abank no bigquery
|
|
194
191
|
def re_apaga
|
|
195
|
-
return self if
|
|
192
|
+
return self if ctlct.empty?
|
|
196
193
|
|
|
197
194
|
# para nao apagar contrato arrendamento - somente as rendas
|
|
198
195
|
opcao[:t] = false
|
|
@@ -293,5 +290,17 @@ module Abank
|
|
|
293
290
|
rescue StandardError
|
|
294
291
|
@bqnrs = 0
|
|
295
292
|
end
|
|
293
|
+
|
|
294
|
+
# executa Stored Procedure (STP) with DML operations no bigquery
|
|
295
|
+
#
|
|
296
|
+
# @param (see job)
|
|
297
|
+
# @return [Integer] numero rows afetadas pelo STP
|
|
298
|
+
def stp(cmd)
|
|
299
|
+
# last command STP=SELECT @@row_count AS rows_affected;
|
|
300
|
+
# se job.failed? executa Integer(nil) => StandardError
|
|
301
|
+
@bqnrs = Integer(job(cmd).data.first[:rows_affected])
|
|
302
|
+
rescue StandardError
|
|
303
|
+
@bqnrs = 0
|
|
304
|
+
end
|
|
296
305
|
end
|
|
297
306
|
end
|
data/lib/abank/version.rb
CHANGED
data/lib/abank.rb
CHANGED
|
@@ -53,10 +53,9 @@ module Abank
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
desc 'recriare', 'atualiza rendas dos contratos ativos'
|
|
56
|
-
option :t, type: :boolean, default: false, desc: 'atualiza todas as rendas?'
|
|
57
56
|
# atualiza rendas dos contratos ativos
|
|
58
57
|
def recriare
|
|
59
|
-
Big.new(
|
|
58
|
+
Big.new().re_atualiza
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
desc 'work', 'carrega/apaga dados da folha calculo'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: abank
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hernâni Rodrigues Vaz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-01-
|
|
11
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|