parroquia 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/parroquia +3 -0
- data/lib/parroquia/actualizar_bautismo.rb +213 -0
- data/lib/parroquia/actualizar_confirmacion.rb +157 -0
- data/lib/parroquia/actualizar_matrimonio.rb +196 -0
- data/lib/parroquia/bautizo.rb +180 -0
- data/lib/parroquia/confirmacion.rb +143 -0
- data/lib/parroquia/consultas.rb +104 -0
- data/lib/parroquia/main.rb +84 -0
- data/lib/parroquia/matrimonio.rb +174 -0
- data/lib/parroquia/resultados.rb +413 -0
- metadata +114 -0
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'fox16'
|
2
|
+
include Fox
|
3
|
+
|
4
|
+
class Matrimonio < FXMainWindow
|
5
|
+
def initialize(app)
|
6
|
+
super(app, "Parroquia San Judas Tadeo", :width => 1050, :height => 530)
|
7
|
+
# create label
|
8
|
+
@lbltitle = FXLabel.new(self, "Bienvenido a la Parroquia San Judas Tadeo", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 20)
|
9
|
+
# create label
|
10
|
+
@lblsubtitle = FXLabel.new(self, "ARQUIDIOSESIS DE QUITO - VICARIA NORTE SERVICIO PARROQUIAL DE SAN JUDAS TADEO", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 40)
|
11
|
+
|
12
|
+
#create label
|
13
|
+
@date = Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
14
|
+
@lbldate = FXLabel.new(self, "Fecha: #{@date}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1000, :height => 20, :x => 0, :y => 60)
|
15
|
+
#section libros
|
16
|
+
@lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 100)
|
17
|
+
@input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
|
18
|
+
@lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
|
19
|
+
@input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
|
20
|
+
@lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
|
21
|
+
@input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
|
22
|
+
|
23
|
+
#section datos
|
24
|
+
@lbl_fecha = FXLabel.new(self, "Fecha de matrimonio (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
|
25
|
+
@input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
|
26
|
+
@lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
|
27
|
+
@input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
|
28
|
+
@lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
|
29
|
+
@input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
|
30
|
+
@lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
|
31
|
+
@input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
|
32
|
+
@lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 180)
|
33
|
+
@input_parroco = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 180)
|
34
|
+
@lbl_celebrante = FXLabel.new(self, "Celebrante: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
|
35
|
+
@input_celebrante = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
|
36
|
+
@lbl_name_novio = FXLabel.new(self, "Nombres del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
|
37
|
+
@input_name_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
|
38
|
+
@lbl_apellido_novio = FXLabel.new(self, "Apellidos del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
|
39
|
+
@input_apellido_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 240)
|
40
|
+
@lbl_cedula_novio = FXLabel.new(self, "Cédula del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 240)
|
41
|
+
@input_cedula_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 240)
|
42
|
+
@lbl_name_novia = FXLabel.new(self, "Nombres de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
|
43
|
+
@input_name_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
|
44
|
+
@lbl_apellido_novia = FXLabel.new(self, "Apellidos de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 270)
|
45
|
+
@input_apellido_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 270)
|
46
|
+
@lbl_cedula_novia = FXLabel.new(self, "Cédula de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 270)
|
47
|
+
@input_cedula_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 270)
|
48
|
+
@lbl_testigo_novio = FXLabel.new(self, "Testigo del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
|
49
|
+
@input_nombres_testigo_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
|
50
|
+
@lbl_testigo_novia = FXLabel.new(self, "Testigo novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 300)
|
51
|
+
@input_nombres_testigo_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 300)
|
52
|
+
@lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 300)
|
53
|
+
@input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 300)
|
54
|
+
|
55
|
+
#section registro civil
|
56
|
+
@lbl_reg_civ = FXLabel.new(self, "------------------------------------ REGISTRO CIVIL ------------------------------------", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 10, :y => 330)
|
57
|
+
@lbl_provincia_rc = FXLabel.new(self, "Provincia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
|
58
|
+
@input_provincia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 360)
|
59
|
+
@lbl_canton_rc = FXLabel.new(self, "Cantón: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 360)
|
60
|
+
@input_canton_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y =>360)
|
61
|
+
@lbl_parroquia_rc = FXLabel.new(self, "Parroquia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 360)
|
62
|
+
@input_parroquia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850,:y => 360)
|
63
|
+
@lbl_anio_rc = FXLabel.new(self, "Año: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 390)
|
64
|
+
@input_anio_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 110,:y => 390)
|
65
|
+
@lbl_tomo_rc = FXLabel.new(self, "Tomo: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 390)
|
66
|
+
@input_tomo_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 230,:y => 390)
|
67
|
+
@lbl_pag_rc = FXLabel.new(self, "Página: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 390)
|
68
|
+
@input_pag_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 350,:y => 390)
|
69
|
+
@lbl_acta_rc = FXLabel.new(self, "Acta: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 410, :y => 390)
|
70
|
+
@input_acta_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 470,:y => 390)
|
71
|
+
@lbl_date_rc = FXLabel.new(self, "Fecha (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 420)
|
72
|
+
@input_date_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 420)
|
73
|
+
|
74
|
+
|
75
|
+
# create buttons
|
76
|
+
@btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 480)
|
77
|
+
@btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 480)
|
78
|
+
|
79
|
+
# connect buttons
|
80
|
+
@btnsave.connect(SEL_COMMAND) do
|
81
|
+
tomo = @input_tomo.text
|
82
|
+
page = @input_page.text
|
83
|
+
number = @input_number.text
|
84
|
+
fecha = @input_fecha.text
|
85
|
+
sacramento = @input_sacramento.text
|
86
|
+
parroquia = @input_parroquia.text
|
87
|
+
sector = @input_sector.text
|
88
|
+
parroco = @input_parroco.text
|
89
|
+
celebrante = @input_celebrante.text
|
90
|
+
name_novio = @input_name_novio.text
|
91
|
+
apellido_novio = @input_apellido_novio.text
|
92
|
+
cedula_novio = @input_cedula_novio.text.empty? ? nil : @input_cedula_novio.text
|
93
|
+
nombres_novia = @input_name_novia.text.empty? ? nil : @input_name_novia.text
|
94
|
+
apellidos_novia = @input_apellido_novia.text.empty? ? nil : @input_apellido_novia.text
|
95
|
+
cedula_novia = @input_cedula_novia.text.empty? ? nil : @input_cedula_novia.text
|
96
|
+
testigo_novio = @input_nombres_testigo_novio.text.empty? ? nil : @input_nombres_testigo_novio.text
|
97
|
+
testigo_novia = @input_nombres_testigo_novia.text.empty? ? nil : @input_nombres_testigo_novia.text
|
98
|
+
certifica = @input_certifica.text
|
99
|
+
provincia_rc = @input_provincia_rc.text
|
100
|
+
canton_rc = @input_canton_rc.text
|
101
|
+
parroquia_rc = @input_parroquia_rc.text
|
102
|
+
anio_rc = @input_anio_rc.text
|
103
|
+
tomo_rc = @input_tomo_rc.text
|
104
|
+
pagina_rc = @input_pag_rc.text
|
105
|
+
acta_rc = @input_acta_rc.text
|
106
|
+
fecha_rc = @input_date_rc.text
|
107
|
+
|
108
|
+
begin
|
109
|
+
# tables
|
110
|
+
# tabla libros (id, tomo, pagina, numero)
|
111
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
112
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
113
|
+
# tabla sacramentos (id, nombre, fecha, celebrante, certifica, padrino, madrina, testigo_novio, testigo_novia, padre, madre, nombres_novia, apellidos_novia, cedula_novia, fk_creyentes, fk_parroquias, fk_registros_civiles, fk_libros)
|
114
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
115
|
+
$conn.transaction do
|
116
|
+
$conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
|
117
|
+
$conn.exec('INSERT INTO creyentes (nombres, apellidos, cedula) VALUES ($1, $2, $3)', [name_novio, apellido_novio, cedula_novio])
|
118
|
+
$conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
|
119
|
+
$conn.exec('INSERT INTO registros_civiles (provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc])
|
120
|
+
$conn.exec('INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)', [sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia])
|
121
|
+
$conn.exec("COMMIT")
|
122
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
|
123
|
+
clear_input_fields
|
124
|
+
end
|
125
|
+
rescue PG::Error => e
|
126
|
+
FXMessageBox.error(self, MBOX_OK, "Error", "Error al guardar los datos")
|
127
|
+
# Imprimir el error en la consola
|
128
|
+
puts e.message
|
129
|
+
# Imprimir detalles del error en la consola
|
130
|
+
puts e.backtrace.inspect
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
@btncancel.connect(SEL_COMMAND) do
|
135
|
+
clear_input_fields
|
136
|
+
end
|
137
|
+
|
138
|
+
def clear_input_fields
|
139
|
+
@input_tomo.text = ""
|
140
|
+
@input_page.text = ""
|
141
|
+
@input_number.text = ""
|
142
|
+
@input_fecha.text = ""
|
143
|
+
@input_sacramento.text = ""
|
144
|
+
@input_parroquia.text = ""
|
145
|
+
@input_sector.text = ""
|
146
|
+
@input_parroco.text = ""
|
147
|
+
@input_celebrante.text = ""
|
148
|
+
@input_name_novio.text = ""
|
149
|
+
@input_apellido_novio.text = ""
|
150
|
+
@input_cedula_novio.text = ""
|
151
|
+
@input_name_novia.text = ""
|
152
|
+
@input_apellido_novia.text = ""
|
153
|
+
@input_cedula_novia.text = ""
|
154
|
+
@input_nombres_testigo_novio.text = ""
|
155
|
+
@input_nombres_testigo_novia.text = ""
|
156
|
+
@input_certifica.text = ""
|
157
|
+
@input_provincia_rc.text = ""
|
158
|
+
@input_canton_rc.text = ""
|
159
|
+
@input_parroquia_rc.text = ""
|
160
|
+
@input_anio_rc.text = ""
|
161
|
+
@input_tomo_rc.text = ""
|
162
|
+
@input_pag_rc.text = ""
|
163
|
+
@input_acta_rc.text = ""
|
164
|
+
@input_date_rc.text = ""
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
def create
|
171
|
+
super
|
172
|
+
show(PLACEMENT_SCREEN)
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,413 @@
|
|
1
|
+
require 'pg'
|
2
|
+
require 'prawn'
|
3
|
+
require 'fox16'
|
4
|
+
include Fox
|
5
|
+
|
6
|
+
class ResultadosConsulta < FXMainWindow
|
7
|
+
def initialize(app, result_data)
|
8
|
+
super(app, "Resultados de la Consulta", :width => 800, :height => 600)
|
9
|
+
@app = app
|
10
|
+
|
11
|
+
@result_data = result_data # Los datos de resultados que se pasan a esta clase
|
12
|
+
|
13
|
+
# Crea una tabla para mostrar los resultados
|
14
|
+
@tabla = FXTable.new(self, :opts => LAYOUT_EXPLICIT|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE, :width => 800, :height => 400, :x => 0, :y => 0)
|
15
|
+
@tabla.visibleRows = 10
|
16
|
+
@tabla.visibleColumns = 10
|
17
|
+
# El tamaño de la tabla depende del número de columnas nombrada en poner nombre a las columnas y las filas al numero de registros encontrados
|
18
|
+
@tabla.setTableSize(@result_data.length, 37)
|
19
|
+
|
20
|
+
|
21
|
+
# Llena la tabla con los datos de resultados
|
22
|
+
@result_data.each_with_index do |row, i|
|
23
|
+
row.each_with_index do |col, j|
|
24
|
+
@tabla.setItemText(i, j, col.to_s)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Poner nombre a las columnas
|
29
|
+
@tabla.setColumnText(0, "ID Sacramentos")
|
30
|
+
@tabla.setColumnText(1, "Sacramento")
|
31
|
+
@tabla.setColumnText(2, "Fecha")
|
32
|
+
@tabla.setColumnText(3, "Celebrante")
|
33
|
+
@tabla.setColumnText(4, "Certifica")
|
34
|
+
@tabla.setColumnText(5, "Pdrino")
|
35
|
+
@tabla.setColumnText(6, "Madrina")
|
36
|
+
@tabla.setColumnText(7, "Testigo novio")
|
37
|
+
@tabla.setColumnText(8, "Testigo novia")
|
38
|
+
@tabla.setColumnText(9, "Padre")
|
39
|
+
@tabla.setColumnText(10, "Madre")
|
40
|
+
@tabla.setColumnText(11, "Nombres de la novia")
|
41
|
+
@tabla.setColumnText(12, "Apellidos de la novia")
|
42
|
+
@tabla.setColumnText(13, "Cédula de la novia")
|
43
|
+
@tabla.setColumnText(14, "ID Libros")
|
44
|
+
@tabla.setColumnText(15, "Tomo")
|
45
|
+
@tabla.setColumnText(16, "Página")
|
46
|
+
@tabla.setColumnText(17, "Número")
|
47
|
+
@tabla.setColumnText(18, "ID Creyentes")
|
48
|
+
@tabla.setColumnText(19, "Nombres")
|
49
|
+
@tabla.setColumnText(20, "Apellidos")
|
50
|
+
@tabla.setColumnText(21, "Lugar de nacimiento")
|
51
|
+
@tabla.setColumnText(22, "Fecha de nacimiento")
|
52
|
+
@tabla.setColumnText(23, "Cédula")
|
53
|
+
@tabla.setColumnText(24, "ID Parroquias")
|
54
|
+
@tabla.setColumnText(25, "Parroquia")
|
55
|
+
@tabla.setColumnText(26, "Sector")
|
56
|
+
@tabla.setColumnText(27, "Parroco")
|
57
|
+
@tabla.setColumnText(28, "ID Registros Civiles")
|
58
|
+
@tabla.setColumnText(29, "Provincia")
|
59
|
+
@tabla.setColumnText(30, "Cantón")
|
60
|
+
@tabla.setColumnText(31, "Parroquia")
|
61
|
+
@tabla.setColumnText(32, "Año")
|
62
|
+
@tabla.setColumnText(33, "Tomo")
|
63
|
+
@tabla.setColumnText(34, "Página")
|
64
|
+
@tabla.setColumnText(35, "Acta")
|
65
|
+
@tabla.setColumnText(36, "Fecha")
|
66
|
+
|
67
|
+
# Al hacer clic en una fila, se selecciona la fila completa para imprimir los datos
|
68
|
+
def seleccionar_fila
|
69
|
+
@tabla.each_row do |i|
|
70
|
+
if @tabla.isRowSelected(i.index)
|
71
|
+
@tabla.selectRow(i.index)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def registros_seleccionados
|
77
|
+
registros = []
|
78
|
+
(0...@tabla.numRows).each do |i|
|
79
|
+
if @tabla.isRowSelected(i)
|
80
|
+
registros << @result_data[i]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
registros
|
84
|
+
end
|
85
|
+
|
86
|
+
# Cambiar el formato de la fecga de YYYY-MM-DD a DD de nombre_mes de YYYY
|
87
|
+
def cambiar_formato_fecha(fecha)
|
88
|
+
# split "-" or "/"
|
89
|
+
fecha = fecha.split(/-|\//)
|
90
|
+
# si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
|
91
|
+
if fecha[0].length == 4
|
92
|
+
"#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
|
93
|
+
else
|
94
|
+
"#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Nombre del mes
|
99
|
+
def nombre_mes(mes)
|
100
|
+
meses = {
|
101
|
+
"01" => "enero",
|
102
|
+
"02" => "febrero",
|
103
|
+
"03" => "marzo",
|
104
|
+
"04" => "abril",
|
105
|
+
"05" => "mayo",
|
106
|
+
"06" => "junio",
|
107
|
+
"07" => "julio",
|
108
|
+
"08" => "agosto",
|
109
|
+
"09" => "septiembre",
|
110
|
+
"10" => "octubre",
|
111
|
+
"11" => "noviembre",
|
112
|
+
"12" => "diciembre"
|
113
|
+
}
|
114
|
+
meses[mes]
|
115
|
+
end
|
116
|
+
|
117
|
+
# Nombre de las filas
|
118
|
+
@result_data.each_with_index do |row, i|
|
119
|
+
@tabla.setRowText(i, "Registro #{i+1}")
|
120
|
+
end
|
121
|
+
|
122
|
+
# create buttons
|
123
|
+
@btnprint = FXButton.new(self, "Imprimir", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 10, :y => 430)
|
124
|
+
@btnedit = FXButton.new(self, "Editar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 120, :y => 430)
|
125
|
+
@btndelete = FXButton.new(self, "Eliminar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 230, :y => 430)
|
126
|
+
@btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 340, :y => 430)
|
127
|
+
|
128
|
+
# connect buttons
|
129
|
+
@btnprint.connect(SEL_COMMAND) do
|
130
|
+
seleccionar_directorio
|
131
|
+
imprimir_pdf
|
132
|
+
end
|
133
|
+
|
134
|
+
def seleccionar_directorio
|
135
|
+
dialog = FXDirDialog.new(self, "Seleccionar directorio para guardar PDF")
|
136
|
+
if dialog.execute != 0
|
137
|
+
directorio = dialog.getDirectory
|
138
|
+
#El nombre del directorio son los apellidos y nombres del creyente seguido del sacramento
|
139
|
+
@archivo_pdf = "#{directorio}/#{registros_seleccionados[0][19]} #{registros_seleccionados[0][20]} - #{registros_seleccionados[0][1]}.pdf"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def imprimir_pdf
|
144
|
+
if registros_seleccionados.empty?
|
145
|
+
FXMessageBox.warning(self, MBOX_OK, "Advertencia", "Debe seleccionar al menos un registro")
|
146
|
+
else
|
147
|
+
# Genera el archivo PDF
|
148
|
+
Prawn::Document.generate(@archivo_pdf, :margin => [150, 100, 100, 100]) do |pdf|
|
149
|
+
pdf.font "Helvetica"
|
150
|
+
pdf.font_size 12
|
151
|
+
# Definir tres casos en los que se puede imprimir el certificado y los distintos formatos para bautismo, confirmación y matrimonio
|
152
|
+
# Bautismo
|
153
|
+
|
154
|
+
case registros_seleccionados[0][1]
|
155
|
+
when "Bautismo"
|
156
|
+
# Título del certificado en color rojo
|
157
|
+
pdf.text "CERTIFICADO DE BAUTISMO", :align => :center, :size => 20, :style => :bold, :color => "FF0000"
|
158
|
+
pdf.move_down 20
|
159
|
+
registros_seleccionados.each do |registro|
|
160
|
+
# Añadir márgenes izquierdo y derecho
|
161
|
+
# Fecha actual alineada a la derecha
|
162
|
+
pdf.text "Quito, #{cambiar_formato_fecha(Time.now.strftime("%d/%m/%Y"))}", :align => :right
|
163
|
+
pdf.move_down 20
|
164
|
+
# Tomo, página y número justificado
|
165
|
+
pdf.text "Yo, el infrascrito, certifico en legal forma a petición de la parte interesada que en el libro de bautismos de esta parroquia: Tomo #{registro[15]} - Página #{registro[16]} - Número #{registro[17]}, se halla inscrita la siguiente partida:", :align => :justify
|
166
|
+
pdf.move_down 10
|
167
|
+
# Fecha de bautismo
|
168
|
+
pdf.text "El día #{cambiar_formato_fecha(registro[2])}. En la parroquia de #{registro[25]} en el sector de #{registro[26]}.", :align => :justify
|
169
|
+
pdf.move_down 10
|
170
|
+
# Celebrante
|
171
|
+
pdf.text "El #{registro[3]} bautizó solemnemente a #{registro[19]} #{registro[20]}.", :align => :justify
|
172
|
+
pdf.move_down 10
|
173
|
+
# Fecha de nacimiento
|
174
|
+
pdf.text "Nacido/da en #{registro[21]} el #{cambiar_formato_fecha(registro[22])}.", :align => :justify
|
175
|
+
pdf.move_down 10
|
176
|
+
# Padres
|
177
|
+
pdf.text "Hijo/ja de #{registro[9]} y de #{registro[10]}.", :align => :justify
|
178
|
+
pdf.move_down 10
|
179
|
+
# Padrinos
|
180
|
+
pdf.text "Fueron sus padrinos: #{registro[5]} y #{registro[6]} a quienes se advirtió de sus obligaciones y parentezco espiritual.", :align => :justify
|
181
|
+
pdf.move_down 10
|
182
|
+
# Certifica
|
183
|
+
pdf.text "Lo certifica: #{registro[4]}.", :align => :justify
|
184
|
+
pdf.move_down 10
|
185
|
+
# Registro civil
|
186
|
+
pdf.text "REGISTRO CIVIL", :align => :center, :size => 16
|
187
|
+
pdf.move_down 10
|
188
|
+
pdf.text "Provincia: #{registro[29]}, Cantón: #{registro[30]}, Parroquia: #{registro[31]}", :align => :justify
|
189
|
+
pdf.text "Año: #{registro[32]}, Tomo: #{registro[33]}, Página: #{registro[34]}, Acta: #{registro[35]}", :align => :justify
|
190
|
+
pdf.text "Fecha: #{cambiar_formato_fecha(registro[36])}", :align => :justify
|
191
|
+
pdf.move_down 10
|
192
|
+
# Datos tomados fielmente de original
|
193
|
+
pdf.text "Datos tomados fielmente del original", :align => :center
|
194
|
+
pdf.move_down 40
|
195
|
+
# Firma del párroco
|
196
|
+
pdf.text "_______________________________", :align => :center
|
197
|
+
pdf.move_down 10
|
198
|
+
# Nombre del párroco
|
199
|
+
pdf.text "#{registro[27]}", :align => :center
|
200
|
+
pdf.move_down 10
|
201
|
+
# Parroco
|
202
|
+
pdf.text "Párroco", :align => :center
|
203
|
+
pdf.move_down 10
|
204
|
+
end
|
205
|
+
when "Confirmación"
|
206
|
+
pdf.text "CERTIFICADO DE CONFIRMACIÓN", :align => :center, :size => 20, :style => :bold, :color => "FF0000"
|
207
|
+
pdf.move_down 20
|
208
|
+
registros_seleccionados.each do |registro|
|
209
|
+
# Fecha actual alineada a la derecha
|
210
|
+
pdf.text "Quito, #{cambiar_formato_fecha(Time.now.strftime("%d/%m/%Y"))}", :align => :right
|
211
|
+
pdf.move_down 20
|
212
|
+
# Tomo, página y número justificado
|
213
|
+
pdf.text "Yo, el infrascrito, certifico en legal forma a petición de la parte interesada que en el libro de confirmaciones de esta parroquia: Tomo #{registro[15]} - Página #{registro[16]} - Número #{registro[17]}, se halla inscrita la siguiente partida:", :align => :justify
|
214
|
+
pdf.move_down 10
|
215
|
+
# Fecha de confirmación
|
216
|
+
pdf.text "El día #{cambiar_formato_fecha(registro[2])}. En la parroquia de #{registro[25]} en el sector de #{registro[26]}.", :align => :justify
|
217
|
+
pdf.move_down 10
|
218
|
+
# Celebrante
|
219
|
+
pdf.text "El #{registro[3]} confirmó en la fe critiana católica apostólica romana a #{registro[19]} #{registro[20]}.", :align => :justify
|
220
|
+
pdf.move_down 10
|
221
|
+
# Fecha de nacimiento
|
222
|
+
pdf.text "Nacido/da el #{registro[22]} en #{registro[21]}.", :align => :justify
|
223
|
+
pdf.move_down 10
|
224
|
+
# Padrinos
|
225
|
+
pdf.text "Fueron sus padrinos: #{registro[5]} y #{registro[6]} a quienes se advirtió de sus obligaciones y parentezco espiritual.", :align => :justify
|
226
|
+
pdf.move_down 10
|
227
|
+
# Certifica
|
228
|
+
pdf.text "Lo certifica: #{registro[4]}.", :align => :justify
|
229
|
+
pdf.move_down 10
|
230
|
+
# Datos tomados fielmente de original
|
231
|
+
pdf.text "Datos tomados fielmente del original", :align => :center
|
232
|
+
pdf.move_down 10
|
233
|
+
# Firma del párroco
|
234
|
+
pdf.text "_______________________________", :align => :center
|
235
|
+
pdf.move_down 10
|
236
|
+
# Nombre del párroco
|
237
|
+
pdf.text "#{registro[27]}", :align => :center
|
238
|
+
pdf.move_down 10
|
239
|
+
# Parroco
|
240
|
+
pdf.text "Párroco", :align => :center
|
241
|
+
pdf.move_down 10
|
242
|
+
end
|
243
|
+
when "Matrimonio"
|
244
|
+
pdf.text "CERTIFICADO DE MATRIMONIO", :align => :center, :size => 20, :style => :bold, :color => "FF0000"
|
245
|
+
pdf.move_down 20
|
246
|
+
registros_seleccionados.each do |registro|
|
247
|
+
# Fecha actual alineada a la derecha
|
248
|
+
pdf.text "Quito, #{cambiar_formato_fecha(Time.now.strftime("%d/%m/%Y"))}", :align => :right
|
249
|
+
pdf.move_down 20
|
250
|
+
# Tomo, página y número justificado
|
251
|
+
pdf.text "Yo, el infrascrito, certifico en legal forma a petición de la parte interesada que en el libro de matrimonios de esta parroquia: Tomo #{registro[15]} - Página #{registro[16]} - Número #{registro[17]}, se halla inscrita la siguiente partida:", :align => :justify
|
252
|
+
pdf.move_down 10
|
253
|
+
# Fecha de matrimonio
|
254
|
+
pdf.text "El día #{cambiar_formato_fecha(registro[2])} contrajeron matrimonio #{registro[19]} #{registro[20]} y #{registro[11]} #{registro[12]} en la parroquia de #{registro[25]} en el sector de #{registro[26]}.", :align => :justify
|
255
|
+
pdf.move_down 10
|
256
|
+
# Celebrante
|
257
|
+
pdf.text "Presenció y bendijo el matrimonio el #{registro[3]}.", :align => :justify
|
258
|
+
# Feligreses de la parroquia
|
259
|
+
pdf.text "Feligreses de la parroquia: #{registro[25]}.", :align => :justify
|
260
|
+
pdf.move_down 10
|
261
|
+
# Testigos
|
262
|
+
pdf.text "Fueron sus testigos: #{registro[7]} y #{registro[8]}.", :align => :justify
|
263
|
+
pdf.move_down 10
|
264
|
+
# Cerifica
|
265
|
+
pdf.text "Lo certifica: #{registro[4]}.", :align => :justify
|
266
|
+
pdf.move_down 10
|
267
|
+
# Registro civil
|
268
|
+
pdf.text "REGISTRO CIVIL", :align => :center, :size => 16
|
269
|
+
pdf.move_down 10
|
270
|
+
pdf.text "Provincia: #{registro[29]}, Cantón: #{registro[30]}, Parroquia: #{registro[31]}", :align => :justify
|
271
|
+
pdf.text "Año: #{registro[32]}, Tomo: #{registro[33]}, Página: #{registro[34]}, Acta: #{registro[35]}", :align => :justify
|
272
|
+
pdf.text "Fecha: #{cambiar_formato_fecha(registro[36])}", :align => :justify
|
273
|
+
pdf.move_down 10
|
274
|
+
# Datos tomados fielmente de original
|
275
|
+
pdf.text "Datos tomados fielmente del original", :align => :center
|
276
|
+
pdf.move_down 40
|
277
|
+
# Firma del párroco
|
278
|
+
pdf.text "_______________________________", :align => :center
|
279
|
+
pdf.move_down 10
|
280
|
+
# Nombre del párroco
|
281
|
+
pdf.text "#{registro[27]}", :align => :center
|
282
|
+
pdf.move_down 10
|
283
|
+
# Parroco
|
284
|
+
pdf.text "Párroco", :align => :center
|
285
|
+
pdf.move_down 10
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
# Abre el archivo PDF con el visor de PDF predeterminado del sistema
|
290
|
+
system("xdg-open '#{@archivo_pdf}'")
|
291
|
+
end
|
292
|
+
# Mensaje de confirmación
|
293
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "El archivo PDF se ha generado correctamente")
|
294
|
+
end
|
295
|
+
|
296
|
+
@btnedit.connect(SEL_COMMAND) do
|
297
|
+
# Editar registros seleccionados y actualizar la basee de datos
|
298
|
+
registros_seleccionados.each do |registro|
|
299
|
+
case registros_seleccionados[0][1]
|
300
|
+
when "Bautismo"
|
301
|
+
# Obtenemos el registro de la base de datos
|
302
|
+
sql = "SELECT * FROM sacramentos INNER JOIN libros ON sacramentos.id = libros.id INNER JOIN creyentes ON sacramentos.id = creyentes.id INNER JOIN parroquias ON sacramentos.id = parroquias.id INNER JOIN registros_civiles ON sacramentos.id = registros_civiles.id WHERE sacramentos.id = #{registro[0]}"
|
303
|
+
$conn.exec(sql) do |result|
|
304
|
+
@registros = result.values[0]
|
305
|
+
# Abrimos la ventana de edición
|
306
|
+
require_relative 'actualizar_bautismo'
|
307
|
+
vtnactualizar_bautismo = ActualizarBautismo.new(@app, @registros)
|
308
|
+
vtnactualizar_bautismo.create
|
309
|
+
vtnactualizar_bautismo.show(PLACEMENT_SCREEN)
|
310
|
+
end
|
311
|
+
when "Confirmación"
|
312
|
+
# Obtenemos el registro de la base de datos
|
313
|
+
sql = "SELECT * FROM sacramentos INNER JOIN libros ON sacramentos.id = libros.id INNER JOIN creyentes ON sacramentos.id = creyentes.id INNER JOIN parroquias ON sacramentos.id = parroquias.id INNER JOIN registros_civiles ON sacramentos.id = registros_civiles.id WHERE sacramentos.id = #{registro[0]}"
|
314
|
+
$conn.exec(sql) do |result|
|
315
|
+
@registros = result.values[0]
|
316
|
+
# Abrimos la ventana de edición
|
317
|
+
require_relative 'actualizar_confirmacion'
|
318
|
+
vtnactualizar_confirmacion = ActualizarConfirmacion.new(@app, @registros)
|
319
|
+
vtnactualizar_confirmacion.create
|
320
|
+
vtnactualizar_confirmacion.show(PLACEMENT_SCREEN)
|
321
|
+
end
|
322
|
+
when "Matrimonio"
|
323
|
+
# Obtenemos el registro de la base de datos
|
324
|
+
sql = "SELECT * FROM sacramentos INNER JOIN libros ON sacramentos.id = libros.id INNER JOIN creyentes ON sacramentos.id = creyentes.id INNER JOIN parroquias ON sacramentos.id = parroquias.id INNER JOIN registros_civiles ON sacramentos.id = registros_civiles.id WHERE sacramentos.id = #{registro[0]}"
|
325
|
+
$conn.exec(sql) do |result|
|
326
|
+
@registros = result.values[0]
|
327
|
+
# Abrimos la ventana de edición
|
328
|
+
require_relative 'actualizar_matrimonio'
|
329
|
+
vtnactualizar_matrimonio = ActualizarMatrimonio.new(@app, @registros)
|
330
|
+
vtnactualizar_matrimonio.create
|
331
|
+
vtnactualizar_matrimonio.show(PLACEMENT_SCREEN)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
@btndelete.connect(SEL_COMMAND) do
|
338
|
+
# eliminar registros seleccionados
|
339
|
+
if registros_seleccionados.empty?
|
340
|
+
FXMessageBox.warning(self, MBOX_OK, "Advertencia", "Debe seleccionar al menos un registro")
|
341
|
+
else
|
342
|
+
# Mensaje de confirmación
|
343
|
+
if FXMessageBox.question(self, MBOX_YES_NO, "Confirmación", "¿Está seguro de eliminar los registros seleccionados?") == MBOX_CLICKED_YES
|
344
|
+
registros_seleccionados.each do |registro|
|
345
|
+
# Eliminar registros de la base de datos
|
346
|
+
case registros_seleccionados[0][1]
|
347
|
+
when "Bautismo"
|
348
|
+
# Eliminar registros de la tabla sacramentos
|
349
|
+
sql = "DELETE FROM sacramentos WHERE id = #{registro[0]}"
|
350
|
+
$conn.exec(sql)
|
351
|
+
# Eliminar registros de la tabla libros
|
352
|
+
sql = "DELETE FROM libros WHERE id = #{registro[14]}"
|
353
|
+
$conn.exec(sql)
|
354
|
+
# Eliminar registros de la tabla creyentes
|
355
|
+
sql = "DELETE FROM creyentes WHERE id = #{registro[18]}"
|
356
|
+
$conn.exec(sql)
|
357
|
+
# Eliminar registros de la tabla parroquias
|
358
|
+
sql = "DELETE FROM parroquias WHERE id = #{registro[24]}"
|
359
|
+
$conn.exec(sql)
|
360
|
+
# Eliminar registros de la tabla registros_civiles
|
361
|
+
sql = "DELETE FROM registros_civiles WHERE id = #{registro[28]}"
|
362
|
+
$conn.exec(sql)
|
363
|
+
when "Confirmación"
|
364
|
+
# Eliminar registros de la tabla sacramentos
|
365
|
+
sql = "DELETE FROM sacramentos WHERE id = #{registro[0]}"
|
366
|
+
$conn.exec(sql)
|
367
|
+
# Eliminar registros de la tabla libros
|
368
|
+
sql = "DELETE FROM libros WHERE id = #{registro[14]}"
|
369
|
+
$conn.exec(sql)
|
370
|
+
# Eliminar registros de la tabla creyentes
|
371
|
+
sql = "DELETE FROM creyentes WHERE id = #{registro[18]}"
|
372
|
+
$conn.exec(sql)
|
373
|
+
# Eliminar registros de la tabla parroquias
|
374
|
+
sql = "DELETE FROM parroquias WHERE id = #{registro[24]}"
|
375
|
+
$conn.exec(sql)
|
376
|
+
# Eliminar registros de la tabla registros_civiles
|
377
|
+
sql = "DELETE FROM registros_civiles WHERE id = #{registro[28]}"
|
378
|
+
$conn.exec(sql)
|
379
|
+
when "Matrimonio"
|
380
|
+
# Eliminar registros de la tabla sacramentos
|
381
|
+
sql = "DELETE FROM sacramentos WHERE id = #{registro[0]}"
|
382
|
+
$conn.exec(sql)
|
383
|
+
# Eliminar registros de la tabla libros
|
384
|
+
sql = "DELETE FROM libros WHERE id = #{registro[14]}"
|
385
|
+
$conn.exec(sql)
|
386
|
+
# Eliminar registros de la tabla creyentes
|
387
|
+
sql = "DELETE FROM creyentes WHERE id = #{registro[18]}"
|
388
|
+
$conn.exec(sql)
|
389
|
+
# Eliminar registros de la tabla parroquias
|
390
|
+
sql = "DELETE FROM parroquias WHERE id = #{registro[24]}"
|
391
|
+
$conn.exec(sql)
|
392
|
+
# Eliminar registros de la tabla registros_civiles
|
393
|
+
sql = "DELETE FROM registros_civiles WHERE id = #{registro[28]}"
|
394
|
+
$conn.exec(sql)
|
395
|
+
end
|
396
|
+
# Mensaje de confirmación
|
397
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "Los registros seleccionados se han eliminado correctamente")
|
398
|
+
end
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
@btncancel.connect(SEL_COMMAND) do
|
404
|
+
# cerrar ventana
|
405
|
+
close
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def create
|
410
|
+
super
|
411
|
+
show(PLACEMENT_SCREEN)
|
412
|
+
end
|
413
|
+
end
|