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,207 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class PermisoBautizo < FXMainWindow
5
+ def initialize(app)
6
+ super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 600)
7
+ self.backColor = FXRGB(3, 187, 133)
8
+ # create label
9
+ # Title
10
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
11
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
12
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
13
+ @lbltitle.backColor = FXRGB(3, 187, 133)
14
+ # Subtitle
15
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
16
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
17
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
18
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
19
+ # Date
20
+ @date = Time.now.strftime('%d/%m/%Y')
21
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
22
+ width: 1050, height: 20, x: 0, y: 60, padRight: 20)
23
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
24
+ @lbldate.backColor = FXRGB(3, 187, 133)
25
+
26
+
27
+ # section datos
28
+ @lbl_fecha = FXLabel.new(self, 'Fecha de bautismo (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
29
+ height: 20, x: 10, y: 150)
30
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
31
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
32
+ y: 150)
33
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
34
+ x: 680, y: 150)
35
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
36
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
37
+ y: 150)
38
+ @input_sacramento.text = 'Permiso de Bautismo'
39
+ @input_sacramento.disable
40
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
41
+ x: 10, y: 180)
42
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
43
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
44
+ y: 180)
45
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
46
+ y: 180)
47
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
48
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
49
+ y: 180)
50
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
51
+ y: 180)
52
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
53
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
54
+ y: 180)
55
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
56
+ y: 240)
57
+ @lbl_name.backColor = FXRGB(3, 187, 133)
58
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170, y: 240)
59
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
60
+ x: 340, y: 240)
61
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
62
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
63
+ y: 240)
64
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
65
+ y: 270)
66
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
67
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
68
+ y: 270)
69
+ @lbl_padre = FXLabel.new(self, 'Padre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
70
+ y: 330)
71
+ @lbl_padre.backColor = FXRGB(3, 187, 133)
72
+ @input_padre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
73
+ y: 330)
74
+ @lbl_madre = FXLabel.new(self, 'Madre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
75
+ y: 330)
76
+ @lbl_madre.backColor = FXRGB(3, 187, 133)
77
+ @input_madre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
78
+ y: 330)
79
+ @lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
80
+ y: 360)
81
+ @lbl_padrino.backColor = FXRGB(3, 187, 133)
82
+ @input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
83
+ y: 360)
84
+ @lbl_madrina = FXLabel.new(self, 'Madrina: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
85
+ y: 360)
86
+ @lbl_madrina.backColor = FXRGB(3, 187, 133)
87
+ @input_madrina = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
88
+ y: 360)
89
+ @lbl_certifica = FXLabel.new(self, 'Autoriza: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
90
+ y: 390)
91
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
92
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
93
+ y: 390)
94
+
95
+ # create buttons
96
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
97
+ x: 790, y: 540)
98
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
99
+ x: 900, y: 540)
100
+
101
+ # connect buttons
102
+ @btnsave.connect(SEL_COMMAND) do
103
+ fecha = @input_fecha.text
104
+ sacramento = @input_sacramento.text
105
+ parroquia = @input_parroquia.text
106
+ sector = @input_sector.text
107
+ parroco = @input_parroco.text
108
+ name = @input_name.text
109
+ apellidos = @input_apellidos.text
110
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
111
+ padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
112
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
113
+ padre = @input_padre.text.empty? ? nil : @input_padre.text
114
+ madre = @input_madre.text.empty? ? nil : @input_madre.text
115
+ certifica = @input_certifica.text
116
+
117
+ # tables
118
+ # tabla libros (id, tomo, pagina, numero)
119
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
120
+ # tabla parroquias (id, nombre, sector, parroco)
121
+ # 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)
122
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
123
+ # Iniciar una transacción
124
+ $conn.transaction do
125
+ $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [nil, nil, nil])
126
+ $conn.exec(
127
+ 'INSERT INTO creyentes (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [
128
+ name, apellidos, nil, nil, cedula
129
+ ]
130
+ )
131
+ $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
132
+ [parroquia, sector, parroco])
133
+ $conn.exec(
134
+ '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)', [
135
+ nil, nil, nil, nil, nil, nil, nil, nil
136
+ ]
137
+ )
138
+ # Insertar en la tabla misas
139
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)', [nil, nil, nil])
140
+ $conn.exec(
141
+ 'INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino, madrina, padre, madre) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [
142
+ sacramento, fecha, nil, certifica, padrino, madrina, padre, madre
143
+ ]
144
+ )
145
+ # Confirmar la transacción
146
+ $conn.exec('COMMIT')
147
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
148
+ clear_input_fields
149
+ end
150
+ end
151
+
152
+ @btncancel.connect(SEL_COMMAND) do
153
+ clear_input_fields
154
+ end
155
+
156
+ def clear_input_fields
157
+ @input_fecha.text = ''
158
+ @input_parroco.text = ''
159
+ @input_name.text = ''
160
+ @input_apellidos.text = ''
161
+ @input_lugar_nacimiento.text = ''
162
+ @input_fecha_nacimiento.text = ''
163
+ @input_cedula.text = ''
164
+ @input_padrino.text = ''
165
+ @input_madrina.text = ''
166
+ @input_padre.text = ''
167
+ @input_madre.text = ''
168
+ @input_certifica.text = ''
169
+ end
170
+ end
171
+
172
+ # Nombre del mes
173
+ def nombre_mes(mes)
174
+ meses = {
175
+ '01' => 'enero',
176
+ '02' => 'febrero',
177
+ '03' => 'marzo',
178
+ '04' => 'abril',
179
+ '05' => 'mayo',
180
+ '06' => 'junio',
181
+ '07' => 'julio',
182
+ '08' => 'agosto',
183
+ '09' => 'septiembre',
184
+ '10' => 'octubre',
185
+ '11' => 'noviembre',
186
+ '12' => 'diciembre'
187
+ }
188
+ meses[mes]
189
+ end
190
+
191
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
192
+ def cambiar_formato_fecha(fecha)
193
+ # split "-" or "/"
194
+ fecha = fecha.split(%r{-|/})
195
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
196
+ if fecha[0].length == 4
197
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
198
+ else
199
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
200
+ end
201
+ end
202
+
203
+ def create
204
+ super
205
+ show(PLACEMENT_SCREEN)
206
+ end
207
+ end
@@ -0,0 +1,219 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class PermisoMatrimonio < 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
+
25
+ # section datos
26
+ @lbl_fecha = FXLabel.new(self, 'Fecha de matrimonio (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
27
+ height: 20, x: 10, y: 150)
28
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
29
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
30
+ y: 150)
31
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
32
+ x: 680, y: 150)
33
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
34
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
35
+ y: 150)
36
+ @input_sacramento.text = 'Permiso de Matrimonio'
37
+ @input_sacramento.disable
38
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
39
+ x: 10, y: 180)
40
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
41
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
42
+ y: 180)
43
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
44
+ y: 180)
45
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
46
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
47
+ y: 180)
48
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
49
+ y: 180)
50
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
51
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
52
+ y: 180)
53
+ @lbl_name_novio = FXLabel.new(self, 'Nombres del novio: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
54
+ x: 10, y: 240)
55
+ @lbl_name_novio.backColor = FXRGB(3, 187, 133)
56
+ @input_name_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
57
+ y: 240)
58
+ @lbl_apellido_novio = FXLabel.new(self, 'Apellidos del novio: ', opts: LAYOUT_EXPLICIT, width: 150,
59
+ height: 20, x: 340, y: 240)
60
+ @lbl_apellido_novio.backColor = FXRGB(3, 187, 133)
61
+ @input_apellido_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
62
+ y: 240)
63
+ @lbl_cedula_novio = FXLabel.new(self, 'Cédula del novio: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
64
+ x: 680, y: 240)
65
+ @lbl_cedula_novio.backColor = FXRGB(3, 187, 133)
66
+ @input_cedula_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
67
+ y: 240)
68
+ @lbl_name_novia = FXLabel.new(self, 'Nombres de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
69
+ height: 20, x: 10, y: 270)
70
+ @lbl_name_novia.backColor = FXRGB(3, 187, 133)
71
+ @input_name_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
72
+ y: 270)
73
+ @lbl_apellido_novia = FXLabel.new(self, 'Apellidos de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
74
+ height: 20, x: 340, y: 270)
75
+ @lbl_apellido_novia.backColor = FXRGB(3, 187, 133)
76
+ @input_apellido_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
77
+ y: 270)
78
+ @lbl_cedula_novia = FXLabel.new(self, 'Cédula de la novia: ', opts: LAYOUT_EXPLICIT, width: 150,
79
+ height: 20, x: 680, y: 270)
80
+ @lbl_cedula_novia.backColor = FXRGB(3, 187, 133)
81
+ @input_cedula_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
82
+ y: 270)
83
+ @lbl_testigo_novio = FXLabel.new(self, 'Testigo del novio: ', opts: LAYOUT_EXPLICIT, width: 150,
84
+ height: 20, x: 10, y: 300)
85
+ @lbl_testigo_novio.backColor = FXRGB(3, 187, 133)
86
+ @input_nombres_testigo_novio = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
87
+ x: 170, y: 300)
88
+ @lbl_testigo_novia = FXLabel.new(self, 'Testigo novia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
89
+ x: 340, y: 300)
90
+ @lbl_testigo_novia.backColor = FXRGB(3, 187, 133)
91
+ @input_nombres_testigo_novia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
92
+ x: 510, y: 300)
93
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
94
+ x: 680, y: 300)
95
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
96
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
97
+ y: 300)
98
+
99
+
100
+ # create buttons
101
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
102
+ x: 790, y: 480)
103
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
104
+ x: 900, y: 480)
105
+
106
+ # connect buttons
107
+ @btnsave.connect(SEL_COMMAND) do
108
+ fecha = @input_fecha.text
109
+ sacramento = @input_sacramento.text
110
+ parroquia = @input_parroquia.text
111
+ sector = @input_sector.text
112
+ parroco = @input_parroco.text
113
+ name_novio = @input_name_novio.text
114
+ apellido_novio = @input_apellido_novio.text
115
+ cedula_novio = @input_cedula_novio.text.empty? ? nil : @input_cedula_novio.text
116
+ nombres_novia = @input_name_novia.text.empty? ? nil : @input_name_novia.text
117
+ apellidos_novia = @input_apellido_novia.text.empty? ? nil : @input_apellido_novia.text
118
+ cedula_novia = @input_cedula_novia.text.empty? ? nil : @input_cedula_novia.text
119
+ testigo_novio = @input_nombres_testigo_novio.text.empty? ? nil : @input_nombres_testigo_novio.text
120
+ testigo_novia = @input_nombres_testigo_novia.text.empty? ? nil : @input_nombres_testigo_novia.text
121
+ certifica = @input_certifica.text
122
+
123
+ # tables
124
+ # tabla libros (id, tomo, pagina, numero)
125
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
126
+ # tabla parroquias (id, nombre, sector, parroco)
127
+ # 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)
128
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
129
+ $conn.transaction do
130
+ $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [nil, nil, nil])
131
+ $conn.exec('INSERT INTO creyentes (nombres, apellidos, cedula) VALUES ($1, $2, $3)',
132
+ [name_novio, apellido_novio, cedula_novio])
133
+ $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
134
+ [parroquia, sector, parroco])
135
+ $conn.exec(
136
+ '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)', [
137
+ nil, nil, nil, nil, nil, nil, nil, nil
138
+ ]
139
+ )
140
+ # Insertar en la tabla misas
141
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)', [nil, nil, nil])
142
+ $conn.exec(
143
+ '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)', [
144
+ sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia
145
+ ]
146
+ )
147
+ $conn.exec('COMMIT')
148
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
149
+ clear_input_fields
150
+ end
151
+ end
152
+
153
+ @btncancel.connect(SEL_COMMAND) do
154
+ clear_input_fields
155
+ end
156
+
157
+ def clear_input_fields
158
+ @input_tomo.text = ''
159
+ @input_page.text = ''
160
+ @input_number.text = ''
161
+ @input_fecha.text = ''
162
+ @input_parroco.text = ''
163
+ @input_celebrante.text = ''
164
+ @input_name_novio.text = ''
165
+ @input_apellido_novio.text = ''
166
+ @input_cedula_novio.text = ''
167
+ @input_name_novia.text = ''
168
+ @input_apellido_novia.text = ''
169
+ @input_cedula_novia.text = ''
170
+ @input_nombres_testigo_novio.text = ''
171
+ @input_nombres_testigo_novia.text = ''
172
+ @input_certifica.text = ''
173
+ @input_provincia_rc.text = ''
174
+ @input_canton_rc.text = ''
175
+ @input_parroquia_rc.text = ''
176
+ @input_anio_rc.text = ''
177
+ @input_tomo_rc.text = ''
178
+ @input_pag_rc.text = ''
179
+ @input_acta_rc.text = ''
180
+ @input_date_rc.text = ''
181
+ end
182
+ end
183
+
184
+ # Nombre del mes
185
+ def nombre_mes(mes)
186
+ meses = {
187
+ '01' => 'enero',
188
+ '02' => 'febrero',
189
+ '03' => 'marzo',
190
+ '04' => 'abril',
191
+ '05' => 'mayo',
192
+ '06' => 'junio',
193
+ '07' => 'julio',
194
+ '08' => 'agosto',
195
+ '09' => 'septiembre',
196
+ '10' => 'octubre',
197
+ '11' => 'noviembre',
198
+ '12' => 'diciembre'
199
+ }
200
+ meses[mes]
201
+ end
202
+
203
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
204
+ def cambiar_formato_fecha(fecha)
205
+ # split "-" or "/"
206
+ fecha = fecha.split(%r{-|/})
207
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
208
+ if fecha[0].length == 4
209
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
210
+ else
211
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
212
+ end
213
+ end
214
+
215
+ def create
216
+ super
217
+ show(PLACEMENT_SCREEN)
218
+ end
219
+ end