parroquia 1.1.13 → 1.1.14
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/lib/parroquia/catecismo/actualizar_alumno.rb +181 -0
- data/lib/parroquia/catecismo/alumno.rb +179 -0
- data/lib/parroquia/catecismo/catecismo.rb +119 -0
- data/lib/parroquia/catecismo/consulta.rb +177 -0
- data/lib/parroquia/catecismo/resultado.rb +230 -0
- data/lib/parroquia/main.rb +82 -91
- data/lib/parroquia/sacramentos/actualizar_bautismo.rb +313 -0
- data/lib/parroquia/sacramentos/actualizar_certificado_prebautismal.rb +184 -0
- data/lib/parroquia/sacramentos/actualizar_comunion.rb +239 -0
- data/lib/parroquia/sacramentos/actualizar_confirmacion.rb +239 -0
- data/lib/parroquia/sacramentos/actualizar_matrimonio.rb +298 -0
- data/lib/parroquia/sacramentos/actualizar_misa.rb +170 -0
- data/lib/parroquia/sacramentos/actualizar_permiso_prebautismal.rb +200 -0
- data/lib/parroquia/sacramentos/actualizar_permiso_prematrimonial.rb +205 -0
- data/lib/parroquia/sacramentos/actualizar_supletoria.rb +313 -0
- data/lib/parroquia/sacramentos/bautizo.rb +310 -0
- data/lib/parroquia/sacramentos/certificado_prebautismal.rb +195 -0
- data/lib/parroquia/sacramentos/comunion.rb +234 -0
- data/lib/parroquia/sacramentos/confirmacion.rb +239 -0
- data/lib/parroquia/sacramentos/consultas.rb +162 -0
- data/lib/parroquia/sacramentos/matrimonio.rb +297 -0
- data/lib/parroquia/sacramentos/misa.rb +171 -0
- data/lib/parroquia/sacramentos/permiso_bautismo.rb +207 -0
- data/lib/parroquia/sacramentos/permiso_prematrimonial.rb +219 -0
- data/lib/parroquia/sacramentos/resultados.rb +931 -0
- data/lib/parroquia/sacramentos/sacramentos.rb +182 -0
- data/lib/parroquia/sacramentos/supletoria.rb +309 -0
- metadata +30 -11
- data/lib/parroquia/actualizar_bautismo.rb +0 -245
- data/lib/parroquia/actualizar_confirmacion.rb +0 -194
- data/lib/parroquia/actualizar_matrimonio.rb +0 -235
- data/lib/parroquia/bautizo.rb +0 -239
- data/lib/parroquia/confirmacion.rb +0 -191
- data/lib/parroquia/consultas.rb +0 -144
- data/lib/parroquia/matrimonio.rb +0 -232
- data/lib/parroquia/resultados.rb +0 -414
@@ -0,0 +1,239 @@
|
|
1
|
+
require 'pg'
|
2
|
+
require 'fox16'
|
3
|
+
include Fox
|
4
|
+
|
5
|
+
class ActualizarComunion < FXMainWindow
|
6
|
+
def initialize(app, registro)
|
7
|
+
@registro = registro
|
8
|
+
super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 450)
|
9
|
+
self.backColor = FXRGB(3, 187, 133)
|
10
|
+
# Title
|
11
|
+
@lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
|
12
|
+
opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
|
13
|
+
@lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
|
14
|
+
@lbltitle.backColor = FXRGB(3, 187, 133)
|
15
|
+
# Subtitle
|
16
|
+
@lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
|
17
|
+
opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
|
18
|
+
@lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
|
19
|
+
@lblsubtitle.backColor = FXRGB(3, 187, 133)
|
20
|
+
# Date
|
21
|
+
@date = Time.now.strftime('%d/%m/%Y')
|
22
|
+
@lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
|
23
|
+
width: 1050, height: 20, x: 0, y: 60, padRight: 20)
|
24
|
+
@lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
|
25
|
+
@lbldate.backColor = FXRGB(3, 187, 133)
|
26
|
+
# section libros
|
27
|
+
@lbl_tomo = FXLabel.new(self, 'Tomo', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50, y: 100)
|
28
|
+
@lbl_tomo.backColor = FXRGB(3, 187, 133)
|
29
|
+
# EL input tomoo debe tener el valor del campo "tomo" del registro
|
30
|
+
@input_tomo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110, y: 100)
|
31
|
+
@input_tomo.text = registro[15]
|
32
|
+
|
33
|
+
@lbl_page = FXLabel.new(self, 'Pagina', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170, y: 100)
|
34
|
+
@lbl_page.backColor = FXRGB(3, 187, 133)
|
35
|
+
@input_page = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230, y: 100)
|
36
|
+
@input_page.text = registro[16]
|
37
|
+
@lbl_number = FXLabel.new(self, 'Numero', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
|
38
|
+
y: 100)
|
39
|
+
@lbl_number.backColor = FXRGB(3, 187, 133)
|
40
|
+
@input_number = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
|
41
|
+
y: 100)
|
42
|
+
@input_number.text = registro[17]
|
43
|
+
# section datos
|
44
|
+
@lbl_fecha = FXLabel.new(self, 'Fecha de la 1ra comunión (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
|
45
|
+
height: 20, x: 10, y: 150)
|
46
|
+
@lbl_fecha.backColor = FXRGB(3, 187, 133)
|
47
|
+
@input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
|
48
|
+
y: 150)
|
49
|
+
@input_fecha.text = @registro[2]
|
50
|
+
@lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
51
|
+
x: 680, y: 150)
|
52
|
+
@lbl_sacramento.backColor = FXRGB(3, 187, 133)
|
53
|
+
@input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
54
|
+
y: 150)
|
55
|
+
@input_sacramento.text = @registro[1]
|
56
|
+
@input_sacramento.disable
|
57
|
+
@lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
58
|
+
x: 10, y: 180)
|
59
|
+
@lbl_parroquia.backColor = FXRGB(3, 187, 133)
|
60
|
+
@input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
61
|
+
y: 180)
|
62
|
+
@input_parroquia.text = @registro[25]
|
63
|
+
@lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
|
64
|
+
y: 180)
|
65
|
+
@lbl_sector.backColor = FXRGB(3, 187, 133)
|
66
|
+
@input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
|
67
|
+
y: 180)
|
68
|
+
@input_sector.text = @registro[26]
|
69
|
+
@lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
|
70
|
+
y: 180)
|
71
|
+
@lbl_parroco.backColor = FXRGB(3, 187, 133)
|
72
|
+
@input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
73
|
+
y: 180)
|
74
|
+
@input_parroco.text = @registro[27]
|
75
|
+
@lbl_celebrante = FXLabel.new(self, 'Celebrante: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
76
|
+
x: 10, y: 210)
|
77
|
+
@lbl_celebrante.backColor = FXRGB(3, 187, 133)
|
78
|
+
@input_celebrante = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
79
|
+
y: 210)
|
80
|
+
@input_celebrante.text = @registro[3]
|
81
|
+
@lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
82
|
+
y: 240)
|
83
|
+
@lbl_name.backColor = FXRGB(3, 187, 133)
|
84
|
+
@input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
85
|
+
y: 240)
|
86
|
+
@input_name.text = @registro[19]
|
87
|
+
@lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
88
|
+
y: 270)
|
89
|
+
@lbl_apellidos.backColor = FXRGB(3, 187, 133)
|
90
|
+
@input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
91
|
+
y: 270)
|
92
|
+
@input_apellidos.text = @registro[20]
|
93
|
+
@lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
|
94
|
+
height: 20, x: 10, y: 300)
|
95
|
+
@lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
|
96
|
+
@input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
97
|
+
x: 170, y: 300)
|
98
|
+
@input_lugar_nacimiento.text = @registro[21]
|
99
|
+
@lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
|
100
|
+
width: 250, height: 20, x: 340, y: 300)
|
101
|
+
@lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
|
102
|
+
@input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
103
|
+
x: 590, y: 300)
|
104
|
+
@input_fecha_nacimiento.text = @registro[22]
|
105
|
+
@lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 80, height: 20, x: 750,
|
106
|
+
y: 300)
|
107
|
+
@lbl_cedula.backColor = FXRGB(3, 187, 133)
|
108
|
+
@input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
109
|
+
y: 300)
|
110
|
+
@input_cedula.text = @registro[23]
|
111
|
+
@lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
112
|
+
y: 330)
|
113
|
+
@lbl_padrino.backColor = FXRGB(3, 187, 133)
|
114
|
+
@input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
115
|
+
y: 330)
|
116
|
+
@input_padrino.text = @registro[5]
|
117
|
+
@lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
118
|
+
y: 360)
|
119
|
+
@lbl_certifica.backColor = FXRGB(3, 187, 133)
|
120
|
+
@input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
121
|
+
y: 360)
|
122
|
+
@input_certifica.text = @registro[4]
|
123
|
+
# create buttons
|
124
|
+
@btnupdate = FXButton.new(self, 'Actualizar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
|
125
|
+
x: 790, y: 400)
|
126
|
+
@btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
|
127
|
+
x: 900, y: 400)
|
128
|
+
|
129
|
+
# connect buttons
|
130
|
+
@btnupdate.connect(SEL_COMMAND) do
|
131
|
+
tomo = @input_tomo.text
|
132
|
+
page = @input_page.text
|
133
|
+
number = @input_number.text
|
134
|
+
fecha = @input_fecha.text
|
135
|
+
sacramento = @input_sacramento.text
|
136
|
+
parroquia = @input_parroquia.text
|
137
|
+
sector = @input_sector.text
|
138
|
+
parroco = @input_parroco.text
|
139
|
+
celebrante = @input_celebrante.text
|
140
|
+
name = @input_name.text
|
141
|
+
apellidos = @input_apellidos.text
|
142
|
+
lugar_nacimiento = @input_lugar_nacimiento.text
|
143
|
+
fecha_nacimiento = @input_fecha_nacimiento.text
|
144
|
+
cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
|
145
|
+
padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
|
146
|
+
certifica = @input_certifica.text
|
147
|
+
|
148
|
+
# tables
|
149
|
+
# tabla libros (id, tomo, pagina, numero)
|
150
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
151
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
152
|
+
# 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)
|
153
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
154
|
+
# Iniciar una transacción
|
155
|
+
$conn.transaction do
|
156
|
+
# Actualizar la tabla libros
|
157
|
+
$conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4',
|
158
|
+
[tomo, page, number, registro[14]])
|
159
|
+
|
160
|
+
# Actualizar la tabla creyentes
|
161
|
+
$conn.exec(
|
162
|
+
'UPDATE creyentes SET nombres = $1, apellidos = $2, lugar_nacimiento = $3, fecha_nacimiento = $4, cedula = $5 WHERE id = $6', [
|
163
|
+
name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, registro[18]
|
164
|
+
]
|
165
|
+
)
|
166
|
+
|
167
|
+
# Actualizar la tabla parroquias
|
168
|
+
$conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4',
|
169
|
+
[parroquia, sector, parroco, registro[24]])
|
170
|
+
|
171
|
+
# Actualizar la tabla registros civiles, si no existen datos se crea un registro nuevo con id que corresponda y se llena los demaás datos con nil
|
172
|
+
$conn.exec(
|
173
|
+
'UPDATE registros_civiles SET provincia_rc = $1, canton_rc = $2, parroquia_rc = $3, anio_rc = $4, tomo_rc = $5, pagina_rc = $6, acta_rc = $7, fecha_rc = $8 WHERE id = $9', [
|
174
|
+
nil, nil, nil, nil, nil, nil, nil, nil, registro[28]
|
175
|
+
]
|
176
|
+
)
|
177
|
+
|
178
|
+
# Actualizar la tabla sacramentos
|
179
|
+
$conn.exec(
|
180
|
+
'UPDATE sacramentos SET sacramento = $1, fecha = $2, celebrante = $3, certifica = $4, padrino = $5 WHERE id = $6', [
|
181
|
+
sacramento, fecha, celebrante, certifica, padrino, registro[0]
|
182
|
+
]
|
183
|
+
)
|
184
|
+
|
185
|
+
|
186
|
+
# ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
|
187
|
+
if FXMessageBox.question(self, MBOX_YES_NO, 'Pregunta', '¿Desea guardar los cambios?') == MBOX_CLICKED_YES
|
188
|
+
# Confirmar la transacción
|
189
|
+
$conn.exec('COMMIT')
|
190
|
+
FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos actualizados correctamente')
|
191
|
+
else
|
192
|
+
$conn.exec('ROLLBACK')
|
193
|
+
end
|
194
|
+
close
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
@btncancel.connect(SEL_COMMAND) do
|
199
|
+
FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No se guardarán los cambios')
|
200
|
+
close
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Nombre del mes
|
205
|
+
def nombre_mes(mes)
|
206
|
+
meses = {
|
207
|
+
'01' => 'enero',
|
208
|
+
'02' => 'febrero',
|
209
|
+
'03' => 'marzo',
|
210
|
+
'04' => 'abril',
|
211
|
+
'05' => 'mayo',
|
212
|
+
'06' => 'junio',
|
213
|
+
'07' => 'julio',
|
214
|
+
'08' => 'agosto',
|
215
|
+
'09' => 'septiembre',
|
216
|
+
'10' => 'octubre',
|
217
|
+
'11' => 'noviembre',
|
218
|
+
'12' => 'diciembre'
|
219
|
+
}
|
220
|
+
meses[mes]
|
221
|
+
end
|
222
|
+
|
223
|
+
# Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
|
224
|
+
def cambiar_formato_fecha(fecha)
|
225
|
+
# split "-" or "/"
|
226
|
+
fecha = fecha.split(%r{-|/})
|
227
|
+
# si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
|
228
|
+
if fecha[0].length == 4
|
229
|
+
"#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
|
230
|
+
else
|
231
|
+
"#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def create
|
236
|
+
super
|
237
|
+
show(PLACEMENT_SCREEN)
|
238
|
+
end
|
239
|
+
end
|
@@ -0,0 +1,239 @@
|
|
1
|
+
require 'pg'
|
2
|
+
require 'fox16'
|
3
|
+
include Fox
|
4
|
+
|
5
|
+
class ActualizarConfirmacion < FXMainWindow
|
6
|
+
def initialize(app, registro)
|
7
|
+
@registro = registro
|
8
|
+
super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 450)
|
9
|
+
self.backColor = FXRGB(3, 187, 133)
|
10
|
+
# Title
|
11
|
+
@lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
|
12
|
+
opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
|
13
|
+
@lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
|
14
|
+
@lbltitle.backColor = FXRGB(3, 187, 133)
|
15
|
+
# Subtitle
|
16
|
+
@lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
|
17
|
+
opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
|
18
|
+
@lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
|
19
|
+
@lblsubtitle.backColor = FXRGB(3, 187, 133)
|
20
|
+
# Date
|
21
|
+
@date = Time.now.strftime('%d/%m/%Y')
|
22
|
+
@lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
|
23
|
+
width: 1050, height: 20, x: 0, y: 60, padRight: 20)
|
24
|
+
@lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
|
25
|
+
@lbldate.backColor = FXRGB(3, 187, 133)
|
26
|
+
# section libros
|
27
|
+
@lbl_tomo = FXLabel.new(self, 'Tomo', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50, y: 100)
|
28
|
+
@lbl_tomo.backColor = FXRGB(3, 187, 133)
|
29
|
+
# EL input tomoo debe tener el valor del campo "tomo" del registro
|
30
|
+
@input_tomo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110, y: 100)
|
31
|
+
@input_tomo.text = registro[15]
|
32
|
+
|
33
|
+
@lbl_page = FXLabel.new(self, 'Pagina', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170, y: 100)
|
34
|
+
@lbl_page.backColor = FXRGB(3, 187, 133)
|
35
|
+
@input_page = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230, y: 100)
|
36
|
+
@input_page.text = registro[16]
|
37
|
+
@lbl_number = FXLabel.new(self, 'Numero', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
|
38
|
+
y: 100)
|
39
|
+
@lbl_number.backColor = FXRGB(3, 187, 133)
|
40
|
+
@input_number = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
|
41
|
+
y: 100)
|
42
|
+
@input_number.text = registro[17]
|
43
|
+
# section datos
|
44
|
+
@lbl_fecha = FXLabel.new(self, 'Fecha de confirmación (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
|
45
|
+
height: 20, x: 10, y: 150)
|
46
|
+
@lbl_fecha.backColor = FXRGB(3, 187, 133)
|
47
|
+
@input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
|
48
|
+
y: 150)
|
49
|
+
@input_fecha.text = @registro[2]
|
50
|
+
@lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
51
|
+
x: 680, y: 150)
|
52
|
+
@lbl_sacramento.backColor = FXRGB(3, 187, 133)
|
53
|
+
@input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
54
|
+
y: 150)
|
55
|
+
@input_sacramento.text = @registro[1]
|
56
|
+
@input_sacramento.disable
|
57
|
+
@lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
58
|
+
x: 10, y: 180)
|
59
|
+
@lbl_parroquia.backColor = FXRGB(3, 187, 133)
|
60
|
+
@input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
61
|
+
y: 180)
|
62
|
+
@input_parroquia.text = @registro[25]
|
63
|
+
@lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
|
64
|
+
y: 180)
|
65
|
+
@lbl_sector.backColor = FXRGB(3, 187, 133)
|
66
|
+
@input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
|
67
|
+
y: 180)
|
68
|
+
@input_sector.text = @registro[26]
|
69
|
+
@lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
|
70
|
+
y: 180)
|
71
|
+
@lbl_parroco.backColor = FXRGB(3, 187, 133)
|
72
|
+
@input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
73
|
+
y: 180)
|
74
|
+
@input_parroco.text = @registro[27]
|
75
|
+
@lbl_celebrante = FXLabel.new(self, 'Celebrante: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
76
|
+
x: 10, y: 210)
|
77
|
+
@lbl_celebrante.backColor = FXRGB(3, 187, 133)
|
78
|
+
@input_celebrante = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
79
|
+
y: 210)
|
80
|
+
@input_celebrante.text = @registro[3]
|
81
|
+
@lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
82
|
+
y: 240)
|
83
|
+
@lbl_name.backColor = FXRGB(3, 187, 133)
|
84
|
+
@input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
85
|
+
y: 240)
|
86
|
+
@input_name.text = @registro[19]
|
87
|
+
@lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
88
|
+
y: 270)
|
89
|
+
@lbl_apellidos.backColor = FXRGB(3, 187, 133)
|
90
|
+
@input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
91
|
+
y: 270)
|
92
|
+
@input_apellidos.text = @registro[20]
|
93
|
+
@lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
|
94
|
+
height: 20, x: 10, y: 300)
|
95
|
+
@lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
|
96
|
+
@input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
97
|
+
x: 170, y: 300)
|
98
|
+
@input_lugar_nacimiento.text = @registro[21]
|
99
|
+
@lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
|
100
|
+
width: 250, height: 20, x: 340, y: 300)
|
101
|
+
@lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
|
102
|
+
@input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
|
103
|
+
x: 590, y: 300)
|
104
|
+
@input_fecha_nacimiento.text = @registro[22]
|
105
|
+
@lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 80, height: 20, x: 750,
|
106
|
+
y: 300)
|
107
|
+
@lbl_cedula.backColor = FXRGB(3, 187, 133)
|
108
|
+
@input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
|
109
|
+
y: 300)
|
110
|
+
@input_cedula.text = @registro[23]
|
111
|
+
@lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
112
|
+
y: 330)
|
113
|
+
@lbl_padrino.backColor = FXRGB(3, 187, 133)
|
114
|
+
@input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
115
|
+
y: 330)
|
116
|
+
@input_padrino.text = @registro[5]
|
117
|
+
@lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
|
118
|
+
y: 360)
|
119
|
+
@lbl_certifica.backColor = FXRGB(3, 187, 133)
|
120
|
+
@input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
|
121
|
+
y: 360)
|
122
|
+
@input_certifica.text = @registro[4]
|
123
|
+
# create buttons
|
124
|
+
@btnupdate = FXButton.new(self, 'Actualizar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
|
125
|
+
x: 790, y: 400)
|
126
|
+
@btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
|
127
|
+
x: 900, y: 400)
|
128
|
+
|
129
|
+
# connect buttons
|
130
|
+
@btnupdate.connect(SEL_COMMAND) do
|
131
|
+
tomo = @input_tomo.text
|
132
|
+
page = @input_page.text
|
133
|
+
number = @input_number.text
|
134
|
+
fecha = @input_fecha.text
|
135
|
+
sacramento = @input_sacramento.text
|
136
|
+
parroquia = @input_parroquia.text
|
137
|
+
sector = @input_sector.text
|
138
|
+
parroco = @input_parroco.text
|
139
|
+
celebrante = @input_celebrante.text
|
140
|
+
name = @input_name.text
|
141
|
+
apellidos = @input_apellidos.text
|
142
|
+
lugar_nacimiento = @input_lugar_nacimiento.text
|
143
|
+
fecha_nacimiento = @input_fecha_nacimiento.text
|
144
|
+
cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
|
145
|
+
padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
|
146
|
+
certifica = @input_certifica.text
|
147
|
+
|
148
|
+
# tables
|
149
|
+
# tabla libros (id, tomo, pagina, numero)
|
150
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
151
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
152
|
+
# 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)
|
153
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
154
|
+
# Iniciar una transacción
|
155
|
+
$conn.transaction do
|
156
|
+
# Actualizar la tabla libros
|
157
|
+
$conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4',
|
158
|
+
[tomo, page, number, registro[14]])
|
159
|
+
|
160
|
+
# Actualizar la tabla creyentes
|
161
|
+
$conn.exec(
|
162
|
+
'UPDATE creyentes SET nombres = $1, apellidos = $2, lugar_nacimiento = $3, fecha_nacimiento = $4, cedula = $5 WHERE id = $6', [
|
163
|
+
name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, registro[18]
|
164
|
+
]
|
165
|
+
)
|
166
|
+
|
167
|
+
# Actualizar la tabla parroquias
|
168
|
+
$conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4',
|
169
|
+
[parroquia, sector, parroco, registro[24]])
|
170
|
+
|
171
|
+
# Actualizar la tabla registros civiles, si no existen datos se crea un registro nuevo con id que corresponda y se llena los demaás datos con nil
|
172
|
+
$conn.exec(
|
173
|
+
'UPDATE registros_civiles SET provincia_rc = $1, canton_rc = $2, parroquia_rc = $3, anio_rc = $4, tomo_rc = $5, pagina_rc = $6, acta_rc = $7, fecha_rc = $8 WHERE id = $9', [
|
174
|
+
nil, nil, nil, nil, nil, nil, nil, nil, registro[28]
|
175
|
+
]
|
176
|
+
)
|
177
|
+
|
178
|
+
# Actualizar la tabla sacramentos
|
179
|
+
$conn.exec(
|
180
|
+
'UPDATE sacramentos SET sacramento = $1, fecha = $2, celebrante = $3, certifica = $4, padrino = $5 WHERE id = $6', [
|
181
|
+
sacramento, fecha, celebrante, certifica, padrino, registro[0]
|
182
|
+
]
|
183
|
+
)
|
184
|
+
|
185
|
+
|
186
|
+
# ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
|
187
|
+
if FXMessageBox.question(self, MBOX_YES_NO, 'Pregunta', '¿Desea guardar los cambios?') == MBOX_CLICKED_YES
|
188
|
+
# Confirmar la transacción
|
189
|
+
$conn.exec('COMMIT')
|
190
|
+
FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos actualizados correctamente')
|
191
|
+
else
|
192
|
+
$conn.exec('ROLLBACK')
|
193
|
+
end
|
194
|
+
close
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
@btncancel.connect(SEL_COMMAND) do
|
199
|
+
FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No se guardarán los cambios')
|
200
|
+
close
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Nombre del mes
|
205
|
+
def nombre_mes(mes)
|
206
|
+
meses = {
|
207
|
+
'01' => 'enero',
|
208
|
+
'02' => 'febrero',
|
209
|
+
'03' => 'marzo',
|
210
|
+
'04' => 'abril',
|
211
|
+
'05' => 'mayo',
|
212
|
+
'06' => 'junio',
|
213
|
+
'07' => 'julio',
|
214
|
+
'08' => 'agosto',
|
215
|
+
'09' => 'septiembre',
|
216
|
+
'10' => 'octubre',
|
217
|
+
'11' => 'noviembre',
|
218
|
+
'12' => 'diciembre'
|
219
|
+
}
|
220
|
+
meses[mes]
|
221
|
+
end
|
222
|
+
|
223
|
+
# Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
|
224
|
+
def cambiar_formato_fecha(fecha)
|
225
|
+
# split "-" or "/"
|
226
|
+
fecha = fecha.split(%r{-|/})
|
227
|
+
# si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
|
228
|
+
if fecha[0].length == 4
|
229
|
+
"#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
|
230
|
+
else
|
231
|
+
"#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def create
|
236
|
+
super
|
237
|
+
show(PLACEMENT_SCREEN)
|
238
|
+
end
|
239
|
+
end
|