-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvc_year.rb
46 lines (35 loc) · 1.04 KB
/
vc_year.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'fileutils'
require_relative 'spensiones'
require_relative 'datatoolbox'
# Exec INIT
thisfile = File.basename(__FILE__)
logg_info("#{thisfile}", tipo='INFO', status='INIT')
# Variables
db = Spensiones.new
year = Time.now.year
fondos = ['A', 'B', 'C', 'D', 'E']
# Nombres directorios
descargas = Dir.pwd + '/' + db.a0.conf.outdir + '/'
rawdata = Dir.pwd + '/rawdata/'
tmp = Dir.pwd + '/tmp'
# Descarga excel valores cuota presente año
for f in fondos
db.vc_excel(year, year, f)
end
# Espera 10 seg para que se descargen los archivos
db.a0.wait.time 10
#Crea directorio rawdata si no existe
makedir(rawdata, by=thisfile)
# Copia excel valores cuota presente agno en rawdata
for f in fondos
FileUtils.cp(descargas + "vcf#{f}#{year}-#{year}.csv", rawdata)
end
# Crea carpeta tmp
makedir(tmp, by=thisfile)
# Indica a cleancsv recrear archivos year
FileUtils.touch('tmp/year')
logg_info("#{thisfile} touch msg to cleancsv", tipo='INFO', status='OK')
# Close Browser
db.a0.quit
# Exec DONE
logg_info("#{thisfile}", tipo='INFO', status='DONE')