parroquia 1.1.13 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parroquia/catecismo/actualizar_alumno.rb +181 -0
  3. data/lib/parroquia/catecismo/alumno.rb +179 -0
  4. data/lib/parroquia/catecismo/catecismo.rb +119 -0
  5. data/lib/parroquia/catecismo/consulta.rb +177 -0
  6. data/lib/parroquia/catecismo/resultado.rb +230 -0
  7. data/lib/parroquia/main.rb +82 -91
  8. data/lib/parroquia/sacramentos/actualizar_bautismo.rb +313 -0
  9. data/lib/parroquia/sacramentos/actualizar_certificado_prebautismal.rb +184 -0
  10. data/lib/parroquia/sacramentos/actualizar_comunion.rb +239 -0
  11. data/lib/parroquia/sacramentos/actualizar_confirmacion.rb +239 -0
  12. data/lib/parroquia/sacramentos/actualizar_matrimonio.rb +298 -0
  13. data/lib/parroquia/sacramentos/actualizar_misa.rb +170 -0
  14. data/lib/parroquia/sacramentos/actualizar_permiso_prebautismal.rb +200 -0
  15. data/lib/parroquia/sacramentos/actualizar_permiso_prematrimonial.rb +205 -0
  16. data/lib/parroquia/sacramentos/actualizar_supletoria.rb +313 -0
  17. data/lib/parroquia/sacramentos/bautizo.rb +310 -0
  18. data/lib/parroquia/sacramentos/certificado_prebautismal.rb +195 -0
  19. data/lib/parroquia/sacramentos/comunion.rb +234 -0
  20. data/lib/parroquia/sacramentos/confirmacion.rb +239 -0
  21. data/lib/parroquia/sacramentos/consultas.rb +162 -0
  22. data/lib/parroquia/sacramentos/matrimonio.rb +297 -0
  23. data/lib/parroquia/sacramentos/misa.rb +171 -0
  24. data/lib/parroquia/sacramentos/permiso_bautismo.rb +207 -0
  25. data/lib/parroquia/sacramentos/permiso_prematrimonial.rb +219 -0
  26. data/lib/parroquia/sacramentos/resultados.rb +922 -0
  27. data/lib/parroquia/sacramentos/sacramentos.rb +182 -0
  28. data/lib/parroquia/sacramentos/supletoria.rb +309 -0
  29. metadata +30 -11
  30. data/lib/parroquia/actualizar_bautismo.rb +0 -245
  31. data/lib/parroquia/actualizar_confirmacion.rb +0 -194
  32. data/lib/parroquia/actualizar_matrimonio.rb +0 -235
  33. data/lib/parroquia/bautizo.rb +0 -239
  34. data/lib/parroquia/confirmacion.rb +0 -191
  35. data/lib/parroquia/consultas.rb +0 -144
  36. data/lib/parroquia/matrimonio.rb +0 -232
  37. data/lib/parroquia/resultados.rb +0 -414
@@ -0,0 +1,297 @@
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
+ self.backColor = FXRGB(3, 187, 133)
8
+ # Title
9
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
10
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
11
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
12
+ @lbltitle.backColor = FXRGB(3, 187, 133)
13
+ # Subtitle
14
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
15
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
16
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
17
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
18
+ # Date
19
+ @date = Time.now.strftime('%d/%m/%Y')
20
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
21
+ width: 1050, height: 20, x: 0, y: 60, padRight: 20)
22
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
23
+ @lbldate.backColor = FXRGB(3, 187, 133)
24
+ # section libros
25
+ @lbl_tomo = FXLabel.new(self, 'Tomo', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50, y: 100)
26
+ @lbl_tomo.backColor = FXRGB(3, 187, 133)
27
+ @input_tomo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110, y: 100)
28
+ @lbl_page = FXLabel.new(self, 'Pagina', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170, y: 100)
29
+ @lbl_page.backColor = FXRGB(3, 187, 133)
30
+ @input_page = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230, y: 100)
31
+ @lbl_number = FXLabel.new(self, 'Numero', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
32
+ y: 100)
33
+ @lbl_number.backColor = FXRGB(3, 187, 133)
34
+ @input_number = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
35
+ y: 100)
36
+
37
+ # section datos
38
+ @lbl_fecha = FXLabel.new(self, 'Fecha de matrimonio (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
39
+ height: 20, x: 10, y: 150)
40
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
41
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
42
+ y: 150)
43
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
44
+ x: 680, y: 150)
45
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
46
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
47
+ y: 150)
48
+ @input_sacramento.text = 'Matrimonio'
49
+ @input_sacramento.disable
50
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
51
+ x: 10, y: 180)
52
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
53
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
54
+ y: 180)
55
+ @input_parroquia.text = 'San Judas Tadeo'
56
+ @input_parroquia.disable
57
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
58
+ y: 180)
59
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
60
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
61
+ y: 180)
62
+ @input_sector.text = 'Jaime Roldós'
63
+ @input_sector.disable
64
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
65
+ y: 180)
66
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
67
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
68
+ y: 180)
69
+ @lbl_celebrante = FXLabel.new(self, 'Celebrante: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
70
+ x: 10, y: 210)
71
+ @lbl_celebrante.backColor = FXRGB(3, 187, 133)
72
+ @input_celebrante = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
73
+ y: 210)
74
+ @lbl_name_novio = FXLabel.new(self, 'Nombres del novio: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
75
+ x: 10, y: 240)
76
+ @lbl_name_novio.backColor = FXRGB(3, 187, 133)
77
+ @input_name_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
78
+ y: 240)
79
+ @lbl_apellido_novio = FXLabel.new(self, 'Apellidos del novio: ', opts: LAYOUT_EXPLICIT, width: 150,
80
+ height: 20, x: 340, y: 240)
81
+ @lbl_apellido_novio.backColor = FXRGB(3, 187, 133)
82
+ @input_apellido_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
83
+ y: 240)
84
+ @lbl_cedula_novio = FXLabel.new(self, 'Cédula del novio: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
85
+ x: 680, y: 240)
86
+ @lbl_cedula_novio.backColor = FXRGB(3, 187, 133)
87
+ @input_cedula_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
88
+ y: 240)
89
+ @lbl_name_novia = FXLabel.new(self, 'Nombres de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
90
+ height: 20, x: 10, y: 270)
91
+ @lbl_name_novia.backColor = FXRGB(3, 187, 133)
92
+ @input_name_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
93
+ y: 270)
94
+ @lbl_apellido_novia = FXLabel.new(self, 'Apellidos de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
95
+ height: 20, x: 340, y: 270)
96
+ @lbl_apellido_novia.backColor = FXRGB(3, 187, 133)
97
+ @input_apellido_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
98
+ y: 270)
99
+ @lbl_cedula_novia = FXLabel.new(self, 'Cédula de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
100
+ height: 20, x: 680, y: 270)
101
+ @lbl_cedula_novia.backColor = FXRGB(3, 187, 133)
102
+ @input_cedula_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
103
+ y: 270)
104
+ @lbl_testigo_novio = FXLabel.new(self, 'Testigo del novio: ', opts: LAYOUT_EXPLICIT, width: 150,
105
+ height: 20, x: 10, y: 300)
106
+ @lbl_testigo_novio.backColor = FXRGB(3, 187, 133)
107
+ @input_nombres_testigo_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
108
+ x: 170, y: 300)
109
+ @lbl_testigo_novia = FXLabel.new(self, 'Testigo novia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
110
+ x: 340, y: 300)
111
+ @lbl_testigo_novia.backColor = FXRGB(3, 187, 133)
112
+ @input_nombres_testigo_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
113
+ x: 510, y: 300)
114
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
115
+ x: 680, y: 300)
116
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
117
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
118
+ y: 300)
119
+
120
+ # section registro civil
121
+ @lbl_reg_civ = FXLabel.new(self,
122
+ '------------------------------------ REGISTRO CIVIL ------------------------------------', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 10, y: 330)
123
+ @lbl_reg_civ.backColor = FXRGB(3, 187, 133)
124
+ @lbl_provincia_rc = FXLabel.new(self, 'Provincia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
125
+ x: 10, y: 360)
126
+ @lbl_provincia_rc.backColor = FXRGB(3, 187, 133)
127
+ @input_provincia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
128
+ y: 360)
129
+ @lbl_canton_rc = FXLabel.new(self, 'Cantón: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
130
+ y: 360)
131
+ @lbl_canton_rc.backColor = FXRGB(3, 187, 133)
132
+ @input_canton_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
133
+ y: 360)
134
+ @lbl_parroquia_rc = FXLabel.new(self, 'Parroquia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
135
+ x: 680, y: 360)
136
+ @lbl_parroquia_rc.backColor = FXRGB(3, 187, 133)
137
+ @input_parroquia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
138
+ y: 360)
139
+ @lbl_anio_rc = FXLabel.new(self, 'Año: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50,
140
+ y: 390)
141
+ @lbl_anio_rc.backColor = FXRGB(3, 187, 133)
142
+ @input_anio_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110,
143
+ y: 390)
144
+ @lbl_tomo_rc = FXLabel.new(self, 'Tomo: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170,
145
+ y: 390)
146
+ @lbl_tomo_rc.backColor = FXRGB(3, 187, 133)
147
+ @input_tomo_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230,
148
+ y: 390)
149
+ @lbl_pag_rc = FXLabel.new(self, 'Página: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
150
+ y: 390)
151
+ @lbl_pag_rc.backColor = FXRGB(3, 187, 133)
152
+ @input_pag_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
153
+ y: 390)
154
+ @lbl_acta_rc = FXLabel.new(self, 'Acta: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 410,
155
+ y: 390)
156
+ @lbl_acta_rc.backColor = FXRGB(3, 187, 133)
157
+ @input_acta_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 470,
158
+ y: 390)
159
+ @lbl_date_rc = FXLabel.new(self, 'Fecha (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
160
+ x: 10, y: 420)
161
+ @lbl_date_rc.backColor = FXRGB(3, 187, 133)
162
+ @input_date_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
163
+ y: 420)
164
+
165
+
166
+ # create buttons
167
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
168
+ x: 790, y: 480)
169
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
170
+ x: 900, y: 480)
171
+
172
+ # connect buttons
173
+ @btnsave.connect(SEL_COMMAND) do
174
+ tomo = @input_tomo.text
175
+ page = @input_page.text
176
+ number = @input_number.text
177
+ fecha = @input_fecha.text
178
+ sacramento = @input_sacramento.text
179
+ parroquia = @input_parroquia.text
180
+ sector = @input_sector.text
181
+ parroco = @input_parroco.text
182
+ celebrante = @input_celebrante.text
183
+ name_novio = @input_name_novio.text
184
+ apellido_novio = @input_apellido_novio.text
185
+ cedula_novio = @input_cedula_novio.text.empty? ? nil : @input_cedula_novio.text
186
+ nombres_novia = @input_name_novia.text.empty? ? nil : @input_name_novia.text
187
+ apellidos_novia = @input_apellido_novia.text.empty? ? nil : @input_apellido_novia.text
188
+ cedula_novia = @input_cedula_novia.text.empty? ? nil : @input_cedula_novia.text
189
+ testigo_novio = @input_nombres_testigo_novio.text.empty? ? nil : @input_nombres_testigo_novio.text
190
+ testigo_novia = @input_nombres_testigo_novia.text.empty? ? nil : @input_nombres_testigo_novia.text
191
+ certifica = @input_certifica.text
192
+ provincia_rc = @input_provincia_rc.text
193
+ canton_rc = @input_canton_rc.text
194
+ parroquia_rc = @input_parroquia_rc.text
195
+ anio_rc = @input_anio_rc.text
196
+ tomo_rc = @input_tomo_rc.text
197
+ pagina_rc = @input_pag_rc.text
198
+ acta_rc = @input_acta_rc.text
199
+ fecha_rc = @input_date_rc.text
200
+
201
+ # tables
202
+ # tabla libros (id, tomo, pagina, numero)
203
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
204
+ # tabla parroquias (id, nombre, sector, parroco)
205
+ # 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)
206
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
207
+ $conn.transaction do
208
+ $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
209
+ $conn.exec('INSERT INTO creyentes (nombres, apellidos, cedula) VALUES ($1, $2, $3)',
210
+ [name_novio, apellido_novio, cedula_novio])
211
+ $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
212
+ [parroquia, sector, parroco])
213
+ $conn.exec(
214
+ '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)', [
215
+ provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc
216
+ ]
217
+ )
218
+ # Insertar en la tabla misas
219
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)', [nil, nil, nil])
220
+ $conn.exec(
221
+ '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)', [
222
+ sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia
223
+ ]
224
+ )
225
+ $conn.exec('COMMIT')
226
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
227
+ clear_input_fields
228
+ end
229
+ end
230
+
231
+ @btncancel.connect(SEL_COMMAND) do
232
+ clear_input_fields
233
+ end
234
+
235
+ def clear_input_fields
236
+ @input_tomo.text = ''
237
+ @input_page.text = ''
238
+ @input_number.text = ''
239
+ @input_fecha.text = ''
240
+ @input_parroco.text = ''
241
+ @input_celebrante.text = ''
242
+ @input_name_novio.text = ''
243
+ @input_apellido_novio.text = ''
244
+ @input_cedula_novio.text = ''
245
+ @input_name_novia.text = ''
246
+ @input_apellido_novia.text = ''
247
+ @input_cedula_novia.text = ''
248
+ @input_nombres_testigo_novio.text = ''
249
+ @input_nombres_testigo_novia.text = ''
250
+ @input_certifica.text = ''
251
+ @input_provincia_rc.text = ''
252
+ @input_canton_rc.text = ''
253
+ @input_parroquia_rc.text = ''
254
+ @input_anio_rc.text = ''
255
+ @input_tomo_rc.text = ''
256
+ @input_pag_rc.text = ''
257
+ @input_acta_rc.text = ''
258
+ @input_date_rc.text = ''
259
+ end
260
+ end
261
+
262
+ # Nombre del mes
263
+ def nombre_mes(mes)
264
+ meses = {
265
+ '01' => 'enero',
266
+ '02' => 'febrero',
267
+ '03' => 'marzo',
268
+ '04' => 'abril',
269
+ '05' => 'mayo',
270
+ '06' => 'junio',
271
+ '07' => 'julio',
272
+ '08' => 'agosto',
273
+ '09' => 'septiembre',
274
+ '10' => 'octubre',
275
+ '11' => 'noviembre',
276
+ '12' => 'diciembre'
277
+ }
278
+ meses[mes]
279
+ end
280
+
281
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
282
+ def cambiar_formato_fecha(fecha)
283
+ # split "-" or "/"
284
+ fecha = fecha.split(%r{-|/})
285
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
286
+ if fecha[0].length == 4
287
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
288
+ else
289
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
290
+ end
291
+ end
292
+
293
+ def create
294
+ super
295
+ show(PLACEMENT_SCREEN)
296
+ end
297
+ end
@@ -0,0 +1,171 @@
1
+ require 'pg'
2
+ require 'fox16'
3
+ include Fox
4
+
5
+ class Misa < FXMainWindow
6
+ def initialize(app)
7
+ @app = app
8
+ super(app, 'Parroquia San Judas Tadeo', width: 700, height: 370)
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: 700, 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: 700, 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: 700, 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
+
27
+ # section datos
28
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
29
+ x: 10, y: 150)
30
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
31
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
32
+ y: 150)
33
+ @input_sacramento.text = 'Misa'
34
+ @input_sacramento.disable
35
+ @lbl_parroquia = FXLabel.new(self, 'Capilla: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
36
+ y: 180)
37
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
38
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
39
+ y: 180)
40
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 330,
41
+ y: 180)
42
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
43
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 490,
44
+ y: 180)
45
+ @lbl_parroco = FXLabel.new(self, 'Celebrante: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
46
+ y: 210)
47
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
48
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
49
+ y: 210)
50
+ @lbl_intencion = FXLabel.new(self, 'Intención: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
51
+ y: 240)
52
+ @lbl_intencion.backColor = FXRGB(3, 187, 133)
53
+ @input_intencion = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
54
+ y: 240)
55
+ @lbl_fecha = FXLabel.new(self, 'Fecha de la misa (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
56
+ height: 20, x: 10, y: 270)
57
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
58
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x:280,
59
+ y: 270)
60
+ @lbl_hora = FXLabel.new(self, 'Hora (HH:MM): ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
61
+ y: 300)
62
+ @lbl_hora.backColor = FXRGB(3, 187, 133)
63
+ @input_hora = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
64
+ y: 300)
65
+ # create buttons
66
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
67
+ x: 480, y: 330)
68
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
69
+ x: 590, y: 330)
70
+
71
+ # connect buttons
72
+ @btnsave.connect(SEL_COMMAND) do
73
+ sacramento = @input_sacramento.text
74
+ capilla = @input_parroquia.text
75
+ sector = @input_sector.text
76
+ celebrante = @input_parroco.text
77
+ intencion = @input_intencion.text
78
+ fecha_misa = @input_fecha.text
79
+ hora = @input_hora.text
80
+
81
+
82
+ # tables
83
+ # tabla libros (id, tomo, pagina, numero)
84
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
85
+ # tabla parroquias (id, nombre, sector, parroco)
86
+ # 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)
87
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
88
+ # Iniciar una transacción
89
+ $conn.transaction do
90
+ # Insertar en la tabla libros
91
+ @registro_libros = $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [nil, nil, nil])
92
+
93
+ # Insertar en la tabla creyentes
94
+ @registro_creyentes = $conn.exec(
95
+ 'INSERT INTO creyentes (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [
96
+ nil, nil, nil, nil, nil
97
+ ]
98
+ )
99
+
100
+ # Insertar en 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
101
+ @registro_registros_civiles = $conn.exec(
102
+ '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)', [
103
+ nil, nil, nil, nil, nil, nil, nil, nil
104
+ ]
105
+ )
106
+
107
+ # Insertar en la tabla parroquias
108
+ @registro_parroquias = $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
109
+ [capilla, sector, celebrante])
110
+ # Insertar en la tabla misas
111
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)',
112
+ [intencion, fecha_misa, hora])
113
+ # Insetar en la tabla sacramentos y actualizar el id de las claves foraneas
114
+ @registro_sacramentos = $conn.exec('INSERT INTO sacramentos (sacramento) VALUES ($1)', [sacramento])
115
+ # Confirmar la transacción
116
+ $conn.exec('COMMIT')
117
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
118
+ clear_input_fields
119
+ end
120
+ end
121
+
122
+ @btncancel.connect(SEL_COMMAND) do
123
+ clear_input_fields
124
+ end
125
+
126
+ def clear_input_fields
127
+ @input_parroquia.text = ''
128
+ @input_sector.text = ''
129
+ @input_parroco.text = ''
130
+ @input_intencion.text = ''
131
+ @input_fecha.text = ''
132
+ @input_hora.text = ''
133
+ end
134
+ end
135
+
136
+ # Nombre del mes
137
+ def nombre_mes(mes)
138
+ meses = {
139
+ '01' => 'enero',
140
+ '02' => 'febrero',
141
+ '03' => 'marzo',
142
+ '04' => 'abril',
143
+ '05' => 'mayo',
144
+ '06' => 'junio',
145
+ '07' => 'julio',
146
+ '08' => 'agosto',
147
+ '09' => 'septiembre',
148
+ '10' => 'octubre',
149
+ '11' => 'noviembre',
150
+ '12' => 'diciembre'
151
+ }
152
+ meses[mes]
153
+ end
154
+
155
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
156
+ def cambiar_formato_fecha(fecha)
157
+ # split "-" or "/"
158
+ fecha = fecha.split(%r{-|/})
159
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
160
+ if fecha[0].length == 4
161
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
162
+ else
163
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
164
+ end
165
+ end
166
+
167
+ def create
168
+ super
169
+ show(PLACEMENT_SCREEN)
170
+ end
171
+ end