pais_legacy 2.6.15 → 2.6.16
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 +13 -13
- data/lib/pais_legacy/version.rb +1 -1
- data/lib/pais_legacy.rb +33 -33
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b14cd12b4599a01e634b5402905338ea560ed612fb3e741353996f803681edf
|
|
4
|
+
data.tar.gz: 7b09991342fb3d5a32f44038813ecc1ac6d10be4b268f39dcbfaa8ebe8ab6d01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 717c645f192c85c726a43cfbc5e3407044fe17dc2555c49b71bed9517ecfce4917787cc1a4440259c9e35126c19f1631d4a1dd198934a26f175d8428bbf7c4f2
|
|
7
|
+
data.tar.gz: 37ef988bcc0f47a31dcc47f612dd9f0af0c3429984b71b1ce4bd4ed788dd15507f22df5884e35243354ed4ea344c072746063ec2a851b67df43ce0b99a38ac35
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
pais_legacy (2.6.
|
|
4
|
+
pais_legacy (2.6.15)
|
|
5
5
|
net-ssh
|
|
6
6
|
pastel (~> 0.8)
|
|
7
7
|
|
|
@@ -10,24 +10,24 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
ast (2.4.3)
|
|
12
12
|
byebug (12.0.0)
|
|
13
|
-
json (2.
|
|
13
|
+
json (2.17.1)
|
|
14
14
|
language_server-protocol (3.17.0.5)
|
|
15
15
|
lint_roller (1.1.0)
|
|
16
|
-
minitest (5.
|
|
16
|
+
minitest (5.26.2)
|
|
17
17
|
mocha (1.16.1)
|
|
18
18
|
net-ssh (7.3.0)
|
|
19
19
|
parallel (1.27.0)
|
|
20
|
-
parser (3.3.
|
|
20
|
+
parser (3.3.10.0)
|
|
21
21
|
ast (~> 2.4.1)
|
|
22
22
|
racc
|
|
23
23
|
pastel (0.8.0)
|
|
24
24
|
tty-color (~> 0.5)
|
|
25
|
-
prism (1.
|
|
25
|
+
prism (1.6.0)
|
|
26
26
|
racc (1.8.1)
|
|
27
27
|
rainbow (3.1.1)
|
|
28
|
-
rake (13.3.
|
|
29
|
-
regexp_parser (2.
|
|
30
|
-
rubocop (1.
|
|
28
|
+
rake (13.3.1)
|
|
29
|
+
regexp_parser (2.11.3)
|
|
30
|
+
rubocop (1.81.7)
|
|
31
31
|
json (~> 2.3)
|
|
32
32
|
language_server-protocol (~> 3.17.0.2)
|
|
33
33
|
lint_roller (~> 1.1.0)
|
|
@@ -35,18 +35,18 @@ GEM
|
|
|
35
35
|
parser (>= 3.3.0.2)
|
|
36
36
|
rainbow (>= 2.2.2, < 4.0)
|
|
37
37
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
38
|
-
rubocop-ast (>= 1.
|
|
38
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
39
39
|
ruby-progressbar (~> 1.7)
|
|
40
40
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
41
|
-
rubocop-ast (1.
|
|
41
|
+
rubocop-ast (1.48.0)
|
|
42
42
|
parser (>= 3.3.7.2)
|
|
43
43
|
prism (~> 1.4)
|
|
44
44
|
ruby-progressbar (1.13.0)
|
|
45
45
|
timecop (0.9.10)
|
|
46
46
|
tty-color (0.6.0)
|
|
47
|
-
unicode-display_width (3.
|
|
48
|
-
unicode-emoji (~> 4.
|
|
49
|
-
unicode-emoji (4.0
|
|
47
|
+
unicode-display_width (3.2.0)
|
|
48
|
+
unicode-emoji (~> 4.1)
|
|
49
|
+
unicode-emoji (4.1.0)
|
|
50
50
|
|
|
51
51
|
PLATFORMS
|
|
52
52
|
x86_64-linux
|
data/lib/pais_legacy/version.rb
CHANGED
data/lib/pais_legacy.rb
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
require 'date'
|
|
4
4
|
require 'json' # Output
|
|
5
|
-
require
|
|
5
|
+
require 'open3' # File I/O
|
|
6
6
|
require 'pastel' # TTY Color
|
|
7
7
|
require 'net/ssh'
|
|
8
|
-
require 'byebug' unless ENV[
|
|
8
|
+
require 'byebug' unless ENV['RACK_ENV'] == 'production' or ENV['RAILS_ENV'] == 'production'
|
|
9
9
|
|
|
10
|
-
require_relative
|
|
11
|
-
require_relative
|
|
10
|
+
require_relative 'pais_legacy/trial_balance'
|
|
11
|
+
require_relative 'pais_legacy/version'
|
|
12
12
|
|
|
13
13
|
module PaisLegacy
|
|
14
14
|
class Error < StandardError; end
|
|
15
15
|
|
|
16
16
|
class Pais
|
|
17
|
-
#SERVER=
|
|
18
|
-
SERVER=
|
|
19
|
-
USER=
|
|
20
|
-
KEY=
|
|
17
|
+
#SERVER='192.168.200.4'
|
|
18
|
+
SERVER='pais.com.au'
|
|
19
|
+
USER='map7'
|
|
20
|
+
KEY='/home/map7/.ssh/id_rsa'
|
|
21
21
|
|
|
22
22
|
MAX_RETRIES = 5
|
|
23
23
|
RETRY_DELAY = 1 # seconds
|
|
@@ -31,7 +31,7 @@ module PaisLegacy
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.execute_ssh_command(command)
|
|
34
|
-
output =
|
|
34
|
+
output = ''
|
|
35
35
|
retries = 0
|
|
36
36
|
|
|
37
37
|
begin
|
|
@@ -42,11 +42,11 @@ module PaisLegacy
|
|
|
42
42
|
ssh.open_channel do |channel|
|
|
43
43
|
# Request a pseudo-tty
|
|
44
44
|
channel.request_pty do |ch, success|
|
|
45
|
-
raise
|
|
45
|
+
raise 'Could not obtain pty' unless success
|
|
46
46
|
|
|
47
47
|
# Execute the command
|
|
48
48
|
ch.exec(command) do |ch, success|
|
|
49
|
-
raise
|
|
49
|
+
raise 'Could not execute command' unless success
|
|
50
50
|
|
|
51
51
|
# Collect the data received from the command's standard output
|
|
52
52
|
ch.on_data do |c, data|
|
|
@@ -59,7 +59,7 @@ module PaisLegacy
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
ch.on_close do
|
|
62
|
-
puts
|
|
62
|
+
puts 'Command execution finished' if ENV['DEBUG'] == 'true'
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -76,7 +76,7 @@ module PaisLegacy
|
|
|
76
76
|
sleep RETRY_DELAY
|
|
77
77
|
retry
|
|
78
78
|
else
|
|
79
|
-
puts
|
|
79
|
+
puts 'Max retries reached. Could not connect.' if ENV['DEBUG'] == 'true'
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
rescue Errno::ECONNRESET => e
|
|
@@ -86,7 +86,7 @@ module PaisLegacy
|
|
|
86
86
|
sleep RETRY_DELAY
|
|
87
87
|
retry
|
|
88
88
|
else
|
|
89
|
-
puts
|
|
89
|
+
puts 'Max retries reached. Could not connect.' if ENV['DEBUG'] == 'true'
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
rescue StandardError => e
|
|
@@ -103,9 +103,9 @@ module PaisLegacy
|
|
|
103
103
|
# --------------------------------------------------------------------------------
|
|
104
104
|
def self.clfi_read_cmd(client=nil)
|
|
105
105
|
if client
|
|
106
|
-
pais_api(
|
|
106
|
+
pais_api('clfi_read ','10000',client)
|
|
107
107
|
else
|
|
108
|
-
pais_api(
|
|
108
|
+
pais_api('clfi_read ','10000')
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
@@ -119,9 +119,9 @@ module PaisLegacy
|
|
|
119
119
|
# --------------------------------------------------------------------------------
|
|
120
120
|
def self.glfi_read_cmd(ledger=nil)
|
|
121
121
|
if ledger
|
|
122
|
-
pais_api(
|
|
122
|
+
pais_api('glfi_read',ledger)
|
|
123
123
|
else
|
|
124
|
-
pais_api(
|
|
124
|
+
pais_api('glfi_read')
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
@@ -136,16 +136,16 @@ module PaisLegacy
|
|
|
136
136
|
# Accounts
|
|
137
137
|
# --------------------------------------------------------------------------------
|
|
138
138
|
def self.glch_read_cmd(ledger)
|
|
139
|
-
pais_api(
|
|
139
|
+
pais_api('glch_read',ledger)
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def self.glch_read(ledger)
|
|
143
143
|
# out=execute_ssh_command(glch_read_cmd(ledger.to_s))
|
|
144
144
|
# out.
|
|
145
|
-
# split(
|
|
146
|
-
# map{|line| line.split(
|
|
145
|
+
# split('\n').
|
|
146
|
+
# map{|line| line.split(',')}.
|
|
147
147
|
# map{|line| {value: line[0], text: "#{line[0]}-#{line[1]}"}}
|
|
148
|
-
glch_read_all(ledger)[
|
|
148
|
+
glch_read_all(ledger)['accounts'].map {|h| {value: h['code'], text: "#{h['code']}-#{h['description']}"}}
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
def self.glch_read_all(ledger)
|
|
@@ -156,21 +156,21 @@ module PaisLegacy
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
# SCREEN T1 10000 1 999999 0 0 0 001 0 9999 0 9999 0 3 N Y N 5200 6153 1 6110 6 A 1 30/06/2023
|
|
159
|
-
def self.raw(params,program=
|
|
159
|
+
def self.raw(params,program='rdefi00a')
|
|
160
160
|
params = params.gsub(" "," \\")
|
|
161
161
|
|
|
162
162
|
# cmd = ssh + ' "bash -c \"'+ fglgo("rptrun") +' pgs 1 pais '+program+' \''+ params + ' \' \""'
|
|
163
|
-
cmd = fglgo(
|
|
163
|
+
cmd = fglgo('rptrun') +' api 1 pais '+program+' \''+ params + ' \' '
|
|
164
164
|
|
|
165
165
|
out=execute_ssh_command(cmd)
|
|
166
166
|
[out]
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
def self.raw_zsh(params,program=
|
|
169
|
+
def self.raw_zsh(params,program='rdefi00a')
|
|
170
170
|
params = params.gsub(" "," \\")
|
|
171
171
|
|
|
172
172
|
cmd = 'zsh -c "'+ fglgo("rptrun") +' api 1 pais '+program+' \''+ params + ' \' "'
|
|
173
|
-
stdout,
|
|
173
|
+
stdout, _stderr, _status = Open3.capture3(cmd)
|
|
174
174
|
[stdout]
|
|
175
175
|
end
|
|
176
176
|
|
|
@@ -178,17 +178,17 @@ module PaisLegacy
|
|
|
178
178
|
# Performance Report
|
|
179
179
|
# --------------------------------------------------------------------------------
|
|
180
180
|
# '\SCREEN \T1 \336 \spar \N \2 \1 \2 \3 \4 \5 \01/07/2021 \30/06/2022 '
|
|
181
|
-
def self.get_performance(ledger =
|
|
182
|
-
program=
|
|
181
|
+
def self.get_performance(ledger = '1', date_to = '30/06/2022',prior=false,from=1,to=9999)
|
|
182
|
+
program='rglch10a'
|
|
183
183
|
|
|
184
184
|
date_to = Date.parse(date_to)
|
|
185
185
|
date_to = Date.parse("30/06/#{date_to.year}")
|
|
186
186
|
date_from = Date.parse("01/07/#{date_to.year - 1}")
|
|
187
187
|
|
|
188
|
-
cmd = fglgo(
|
|
188
|
+
cmd = fglgo('rptrun') +' pgs 1 pais {{program}} \'\{{printer}} \{{ccode}} \{{ledger}} \spar \N \2 \1 \2 \3 \4 \5 \{{date_from}} \{{date_to}} \' '
|
|
189
189
|
.gsub("{{program}}",program)
|
|
190
|
-
.gsub("{{printer}}",
|
|
191
|
-
.gsub("{{ccode}}",
|
|
190
|
+
.gsub("{{printer}}",'SCREEN')
|
|
191
|
+
.gsub("{{ccode}}",'T1')
|
|
192
192
|
.gsub("{{ledger}}",ledger)
|
|
193
193
|
.gsub("{{account_from}}",from.to_s)
|
|
194
194
|
.gsub("{{account_to}}",to.to_s)
|
|
@@ -204,7 +204,7 @@ module PaisLegacy
|
|
|
204
204
|
# --------------------------------------------------------------------------------
|
|
205
205
|
# Trial Balance
|
|
206
206
|
# --------------------------------------------------------------------------------
|
|
207
|
-
def self.get_trial_balance(ledger =
|
|
207
|
+
def self.get_trial_balance(ledger = '1', date_to = '30/06/2021',prior=false,from=1,to=9999)
|
|
208
208
|
if prior
|
|
209
209
|
program="rglch01p"
|
|
210
210
|
else
|
|
@@ -515,7 +515,7 @@ module PaisLegacy
|
|
|
515
515
|
end
|
|
516
516
|
|
|
517
517
|
def self.table_unload(table)
|
|
518
|
-
|
|
518
|
+
_out = execute_ssh_command(table_unload_cmd(table))
|
|
519
519
|
end
|
|
520
520
|
|
|
521
521
|
def self.tables_cmd
|