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.
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 +931 -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
@@ -1,235 +0,0 @@
1
- require 'fox16'
2
- include Fox
3
-
4
- class ActualizarMatrimonio < FXMainWindow
5
- def initialize(app, registro)
6
- @registro = registro
7
- super(app, "Parroquia San Judas Tadeo", :width => 1050, :height => 530)
8
- self.backColor = FXRGB(3,187,133)
9
- # Title
10
- @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)
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", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 40)
15
- @lblsubtitle.font = FXFont.new(app, "Geneva", 10, FONTWEIGHT_BOLD)
16
- @lblsubtitle.backColor = FXRGB(3,187,133)
17
- # Date
18
- @date = Time.now.strftime("%d/%m/%Y")
19
- @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1050, :height => 20, :x => 0, :y => 60, :padRight => 20)
20
- @lbldate.font = FXFont.new(app, "Geneva", 12, FONTWEIGHT_BOLD)
21
- @lbldate.backColor = FXRGB(3,187,133)
22
- # section libros
23
- @lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 100)
24
- @lbl_tomo.backColor = FXRGB(3,187,133)
25
- # EL input tomoo debe tener el valor del campo "tomo" del registro
26
- @input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
27
- @input_tomo.text = registro[15]
28
-
29
- @lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
30
- @lbl_page.backColor = FXRGB(3,187,133)
31
- @input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
32
- @input_page.text = registro[16]
33
- @lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
34
- @lbl_number.backColor = FXRGB(3,187,133)
35
- @input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
36
- @input_number.text = registro[17]
37
- #section datos
38
- @lbl_fecha = FXLabel.new(self, "Fecha de matrimonio (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
39
- @lbl_fecha.backColor = FXRGB(3,187,133)
40
- @input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
41
- @input_fecha.text = @registro[2]
42
- @lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
43
- @lbl_sacramento.backColor = FXRGB(3,187,133)
44
- @input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
45
- @input_sacramento.text = @registro[1]
46
- @input_sacramento.disable
47
- @lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
48
- @lbl_parroquia.backColor = FXRGB(3,187,133)
49
- @input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
50
- @input_parroquia.text = @registro[25]
51
- @lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
52
- @lbl_sector.backColor = FXRGB(3,187,133)
53
- @input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
54
- @input_sector.text = @registro[26]
55
- @lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 180)
56
- @lbl_parroco.backColor = FXRGB(3,187,133)
57
- @input_parroco = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 180)
58
- @input_parroco.text = @registro[27]
59
- @lbl_celebrante = FXLabel.new(self, "Celebrante: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
60
- @lbl_celebrante.backColor = FXRGB(3,187,133)
61
- @input_celebrante = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
62
- @input_celebrante.text = @registro[3]
63
- @lbl_name_novio = FXLabel.new(self, "Nombres del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
64
- @lbl_name_novio.backColor = FXRGB(3,187,133)
65
- @input_name_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
66
- @input_name_novio.text = @registro[19]
67
- @lbl_apellido_novio = FXLabel.new(self, "Apellidos del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
68
- @lbl_apellido_novio.backColor = FXRGB(3,187,133)
69
- @input_apellido_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 240)
70
- @input_apellido_novio.text = @registro[20]
71
- @lbl_cedula_novio = FXLabel.new(self, "Cédula del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 240)
72
- @lbl_cedula_novio.backColor = FXRGB(3,187,133)
73
- @input_cedula_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 240)
74
- @input_cedula_novio.text = @registro[23]
75
- @lbl_name_novia = FXLabel.new(self, "Nombres de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
76
- @lbl_name_novia.backColor = FXRGB(3,187,133)
77
- @input_name_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
78
- @input_name_novia.text = @registro[11]
79
- @lbl_apellido_novia = FXLabel.new(self, "Apellidos de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 270)
80
- @lbl_apellido_novia.backColor = FXRGB(3,187,133)
81
- @input_apellido_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 270)
82
- @input_apellido_novia.text = @registro[12]
83
- @lbl_cedula_novia = FXLabel.new(self, "Cédula de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 270)
84
- @lbl_cedula_novia.backColor = FXRGB(3,187,133)
85
- @input_cedula_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 270)
86
- @input_cedula_novia.text = @registro[13]
87
- @lbl_testigo_novio = FXLabel.new(self, "Testigo del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
88
- @lbl_testigo_novio.backColor = FXRGB(3,187,133)
89
- @input_nombres_testigo_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
90
- @input_nombres_testigo_novio.text = @registro[7]
91
- @lbl_testigo_novia = FXLabel.new(self, "Testigo novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 300)
92
- @lbl_testigo_novia.backColor = FXRGB(3,187,133)
93
- @input_nombres_testigo_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 300)
94
- @input_nombres_testigo_novia.text = @registro[8]
95
- @lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 300)
96
- @lbl_certifica.backColor = FXRGB(3,187,133)
97
- @input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 300)
98
- @input_certifica.text = @registro[4]
99
- #section registro civil
100
- @lbl_reg_civ = FXLabel.new(self, "------------------------------------ REGISTRO CIVIL ------------------------------------", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 10, :y => 330)
101
- @lbl_reg_civ.backColor = FXRGB(3,187,133)
102
- @lbl_provincia_rc = FXLabel.new(self, "Provincia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
103
- @lbl_provincia_rc.backColor = FXRGB(3,187,133)
104
- @input_provincia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 360)
105
- @input_provincia_rc.text = @registro[29]
106
- @lbl_canton_rc = FXLabel.new(self, "Cantón: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 360)
107
- @lbl_canton_rc.backColor = FXRGB(3,187,133)
108
- @input_canton_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y =>360)
109
- @input_canton_rc.text = @registro[30]
110
- @lbl_parroquia_rc = FXLabel.new(self, "Parroquia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 360)
111
- @lbl_parroquia_rc.backColor = FXRGB(3,187,133)
112
- @input_parroquia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850,:y => 360)
113
- @input_parroquia_rc.text = @registro[31]
114
- @lbl_anio_rc = FXLabel.new(self, "Año: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 390)
115
- @lbl_anio_rc.backColor = FXRGB(3,187,133)
116
- @input_anio_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 110,:y => 390)
117
- @input_anio_rc.text = @registro[32]
118
- @lbl_tomo_rc = FXLabel.new(self, "Tomo: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 390)
119
- @lbl_tomo_rc.backColor = FXRGB(3,187,133)
120
- @input_tomo_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 230,:y => 390)
121
- @input_tomo_rc.text = @registro[33]
122
- @lbl_pag_rc = FXLabel.new(self, "Página: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 390)
123
- @lbl_pag_rc.backColor = FXRGB(3,187,133)
124
- @input_pag_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 350,:y => 390)
125
- @input_pag_rc.text = @registro[34]
126
- @lbl_acta_rc = FXLabel.new(self, "Acta: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 410, :y => 390)
127
- @lbl_acta_rc.backColor = FXRGB(3,187,133)
128
- @input_acta_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 470,:y => 390)
129
- @input_acta_rc.text = @registro[35]
130
- @lbl_date_rc = FXLabel.new(self, "Fecha (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 420)
131
- @lbl_date_rc.backColor = FXRGB(3,187,133)
132
- @input_date_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 420)
133
- @input_date_rc.text = @registro[36]
134
-
135
- # create buttons
136
- @btnupdate = FXButton.new(self, "Actualizar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 480)
137
- @btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 480)
138
-
139
- # connect buttons
140
- @btnupdate.connect(SEL_COMMAND) do
141
- tomo = @input_tomo.text
142
- page = @input_page.text
143
- number = @input_number.text
144
- fecha = @input_fecha.text
145
- sacramento = @input_sacramento.text
146
- parroquia = @input_parroquia.text
147
- sector = @input_sector.text
148
- parroco = @input_parroco.text
149
- celebrante = @input_celebrante.text
150
- name_novio = @input_name_novio.text
151
- apellido_novio = @input_apellido_novio.text
152
- cedula_novio = @input_cedula_novio.text.empty? ? nil : @input_cedula_novio.text
153
- nombres_novia = @input_name_novia.text.empty? ? nil : @input_name_novia.text
154
- apellidos_novia = @input_apellido_novia.text.empty? ? nil : @input_apellido_novia.text
155
- cedula_novia = @input_cedula_novia.text.empty? ? nil : @input_cedula_novia.text
156
- testigo_novio = @input_nombres_testigo_novio.text.empty? ? nil : @input_nombres_testigo_novio.text
157
- testigo_novia = @input_nombres_testigo_novia.text.empty? ? nil : @input_nombres_testigo_novia.text
158
- certifica = @input_certifica.text
159
- provincia_rc = @input_provincia_rc.text
160
- canton_rc = @input_canton_rc.text
161
- parroquia_rc = @input_parroquia_rc.text
162
- anio_rc = @input_anio_rc.text
163
- tomo_rc = @input_tomo_rc.text
164
- pagina_rc = @input_pag_rc.text
165
- acta_rc = @input_acta_rc.text
166
- fecha_rc = @input_date_rc.text
167
-
168
- # tables
169
- # tabla libros (id, tomo, pagina, numero)
170
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
171
- # tabla parroquias (id, nombre, sector, parroco)
172
- # 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)
173
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
174
- $conn.transaction do
175
- $conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4', [tomo, page, number, registro[14]])
176
- $conn.exec('UPDATE sacramentos SET sacramento = $1, fecha = $2, celebrante = $3, certifica = $4, testigo_novio = $5, testigo_novia = $6, nombres_novia = $7, apellidos_novia = $8, cedula_novia = $9 WHERE id = $10', [sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia, registro[0]])
177
- $conn.exec('UPDATE creyentes SET nombres = $1, apellidos = $2, cedula = $3 WHERE id = $4', [name_novio, apellido_novio, cedula_novio, registro[18]])
178
- $conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4', [parroquia, sector, parroco, registro[24]])
179
- $conn.exec('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', [provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc, registro[28]])
180
-
181
- # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
182
- if FXMessageBox.question(self, MBOX_YES_NO, "Pregunta", "¿Desea guardar los cambios?") == MBOX_CLICKED_YES
183
- $conn.exec("COMMIT")
184
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos actualizados correctamente")
185
- close
186
- else
187
- $conn.exec("ROLLBACK")
188
- close
189
- end
190
- end
191
- end
192
-
193
- @btncancel.connect(SEL_COMMAND) do
194
- FXMessageBox.warning(self, MBOX_OK, "Advertencia", "No se guardarán los cambios")
195
- close
196
- end
197
- end
198
-
199
- # Nombre del mes
200
- def nombre_mes(mes)
201
- meses = {
202
- "01" => "enero",
203
- "02" => "febrero",
204
- "03" => "marzo",
205
- "04" => "abril",
206
- "05" => "mayo",
207
- "06" => "junio",
208
- "07" => "julio",
209
- "08" => "agosto",
210
- "09" => "septiembre",
211
- "10" => "octubre",
212
- "11" => "noviembre",
213
- "12" => "diciembre"
214
- }
215
- meses[mes]
216
- end
217
-
218
-
219
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
220
- def cambiar_formato_fecha(fecha)
221
- # split "-" or "/"
222
- fecha = fecha.split(/-|\//)
223
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
224
- if fecha[0].length == 4
225
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
226
- else
227
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
228
- end
229
- end
230
-
231
- def create
232
- super
233
- show(PLACEMENT_SCREEN)
234
- end
235
- end
@@ -1,239 +0,0 @@
1
- require 'fox16'
2
- include Fox
3
-
4
- class Bautizo < 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", :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", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 40)
15
- @lblsubtitle.font = FXFont.new(app, "Geneva", 10, FONTWEIGHT_BOLD)
16
- @lblsubtitle.backColor = FXRGB(3,187,133)
17
- # Date
18
- @date = Time.now.strftime("%d/%m/%Y")
19
- @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1050, :height => 20, :x => 0, :y => 60, :padRight => 20)
20
- @lbldate.font = FXFont.new(app, "Geneva", 12, FONTWEIGHT_BOLD)
21
- @lbldate.backColor = FXRGB(3,187,133)
22
- # section libros
23
- @lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 100)
24
- @lbl_tomo.backColor = FXRGB(3,187,133)
25
- @input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
26
- @lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
27
- @lbl_page.backColor = FXRGB(3,187,133)
28
- @input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
29
- @lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
30
- @lbl_number.backColor = FXRGB(3,187,133)
31
- @input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
32
-
33
- # section datos
34
- @lbl_fecha = FXLabel.new(self, "Fecha de bautismo (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
35
- @lbl_fecha.backColor = FXRGB(3,187,133)
36
- @input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
37
- @lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
38
- @lbl_sacramento.backColor = FXRGB(3,187,133)
39
- @input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
40
- @input_sacramento.text = "Bautismo"
41
- @input_sacramento.disable
42
- @lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
43
- @lbl_parroquia.backColor = FXRGB(3,187,133)
44
- @input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
45
- @input_parroquia.text = "San Judas Tadeo"
46
- @input_parroquia.disable
47
- @lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
48
- @lbl_sector.backColor = FXRGB(3,187,133)
49
- @input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
50
- @input_sector.text = "Jaime Roldós"
51
- @lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :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, :y => 180)
54
- @lbl_ministro = FXLabel.new(self, "Ministro: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
55
- @lbl_ministro.backColor = FXRGB(3,187,133)
56
- @input_ministro = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
57
- @lbl_name = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
58
- @lbl_name.backColor = FXRGB(3,187,133)
59
- @input_name = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
60
- @lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :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, :y => 240)
63
- @lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
64
- @lbl_cedula.backColor = FXRGB(3,187,133)
65
- @input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
66
- @lbl_lugar_nacimiento = FXLabel.new(self, "Lugar de nacimiento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
67
- @lbl_lugar_nacimiento.backColor = FXRGB(3,187,133)
68
- @input_lugar_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
69
- @lbl_fecha_nacimiento = FXLabel.new(self, "Fecha de nacimiento (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 340, :y => 300)
70
- @lbl_fecha_nacimiento.backColor = FXRGB(3,187,133)
71
- @input_fecha_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 590, :y => 300)
72
- @lbl_padre = FXLabel.new(self, "Padre: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 330)
73
- @lbl_padre.backColor = FXRGB(3,187,133)
74
- @input_padre = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 330)
75
- @lbl_madre = FXLabel.new(self, "Madre: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :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, :y => 330)
78
- @lbl_padrino = FXLabel.new(self, "Padrino: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
79
- @lbl_padrino.backColor = FXRGB(3,187,133)
80
- @input_padrino = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 360)
81
- @lbl_madrina = FXLabel.new(self, "Madrina: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 360)
82
- @lbl_madrina.backColor = FXRGB(3,187,133)
83
- @input_madrina = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 360)
84
- @lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 390)
85
- @lbl_certifica.backColor = FXRGB(3,187,133)
86
- @input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 390)
87
-
88
- # section registro civil
89
- @lbl_reg_civ = FXLabel.new(self, "------------------------------------ REGISTRO CIVIL ------------------------------------", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 10, :y => 420)
90
- @lbl_reg_civ.backColor = FXRGB(3,187,133)
91
- @lbl_provincia_rc = FXLabel.new(self, "Provincia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 450)
92
- @lbl_provincia_rc.backColor = FXRGB(3,187,133)
93
- @input_provincia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 450)
94
- @lbl_canton_rc = FXLabel.new(self, "Cantón: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 450)
95
- @lbl_canton_rc.backColor = FXRGB(3,187,133)
96
- @input_canton_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y =>450)
97
- @lbl_parroquia_rc = FXLabel.new(self, "Parroquia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 450)
98
- @lbl_parroquia_rc.backColor = FXRGB(3,187,133)
99
- @input_parroquia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850,:y => 450)
100
- @lbl_anio_rc = FXLabel.new(self, "Año: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 480)
101
- @lbl_anio_rc.backColor = FXRGB(3,187,133)
102
- @input_anio_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 110,:y => 480)
103
- @lbl_tomo_rc = FXLabel.new(self, "Tomo: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 480)
104
- @lbl_tomo_rc.backColor = FXRGB(3,187,133)
105
- @input_tomo_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 230,:y => 480)
106
- @lbl_pag_rc = FXLabel.new(self, "Página: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 480)
107
- @lbl_pag_rc.backColor = FXRGB(3,187,133)
108
- @input_pag_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 350,:y => 480)
109
- @lbl_acta_rc = FXLabel.new(self, "Acta: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 410, :y => 480)
110
- @lbl_acta_rc.backColor = FXRGB(3,187,133)
111
- @input_acta_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 470,:y => 480)
112
- @lbl_date_rc = FXLabel.new(self, "Fecha (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 510)
113
- @lbl_date_rc.backColor = FXRGB(3,187,133)
114
- @input_date_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 510)
115
-
116
-
117
- # create buttons
118
- @btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 540)
119
- @btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 540)
120
-
121
- # connect buttons
122
- @btnsave.connect(SEL_COMMAND) do
123
- tomo = @input_tomo.text
124
- page = @input_page.text
125
- number = @input_number.text
126
- fecha = @input_fecha.text
127
- sacramento = @input_sacramento.text
128
- parroquia = @input_parroquia.text
129
- sector = @input_sector.text
130
- parroco = @input_parroco.text
131
- ministro = @input_ministro.text
132
- name = @input_name.text
133
- apellidos = @input_apellidos.text
134
- lugar_nacimiento = @input_lugar_nacimiento.text
135
- fecha_nacimiento = @input_fecha_nacimiento.text
136
- cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
137
- padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
138
- madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
139
- padre = @input_padre.text.empty? ? nil : @input_padre.text
140
- madre = @input_madre.text.empty? ? nil : @input_madre.text
141
- certifica = @input_certifica.text
142
- provincia_rc = @input_provincia_rc.text
143
- canton_rc = @input_canton_rc.text
144
- parroquia_rc = @input_parroquia_rc.text
145
- anio_rc = @input_anio_rc.text
146
- tomo_rc = @input_tomo_rc.text
147
- pag_rc = @input_pag_rc.text
148
- acta_rc = @input_acta_rc.text
149
- date_rc = @input_date_rc.text
150
-
151
- # tables
152
- # tabla libros (id, tomo, pagina, numero)
153
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
154
- # tabla parroquias (id, nombre, sector, parroco)
155
- # 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)
156
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
157
- # Iniciar una transacción
158
- $conn.transaction do
159
- $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
160
- $conn.exec('INSERT INTO creyentes (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula])
161
- $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
162
- $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, pag_rc, acta_rc, date_rc])
163
- $conn.exec('INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino, madrina, padre, madre) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [sacramento, fecha, ministro, certifica, padrino, madrina, padre, madre])
164
- # Confirmar la transacción
165
- $conn.exec("COMMIT")
166
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
167
- clear_input_fields
168
- end
169
- end
170
-
171
- @btncancel.connect(SEL_COMMAND) do
172
- clear_input_fields
173
- end
174
-
175
- def clear_input_fields
176
- @input_tomo.text = ""
177
- @input_page.text = ""
178
- @input_number.text = ""
179
- @input_fecha.text = ""
180
- @input_parroco.text = ""
181
- @input_ministro.text = ""
182
- @input_name.text = ""
183
- @input_apellidos.text = ""
184
- @input_lugar_nacimiento.text = ""
185
- @input_fecha_nacimiento.text = ""
186
- @input_cedula.text = ""
187
- @input_padrino.text = ""
188
- @input_madrina.text = ""
189
- @input_padre.text = ""
190
- @input_madre.text = ""
191
- @input_certifica.text = ""
192
- @input_provincia_rc.text = ""
193
- @input_canton_rc.text = ""
194
- @input_parroquia_rc.text = ""
195
- @input_anio_rc.text = ""
196
- @input_tomo_rc.text = ""
197
- @input_pag_rc.text = ""
198
- @input_acta_rc.text = ""
199
- @input_date_rc.text = ""
200
- end
201
- end
202
-
203
- # Nombre del mes
204
- def nombre_mes(mes)
205
- meses = {
206
- "01" => "enero",
207
- "02" => "febrero",
208
- "03" => "marzo",
209
- "04" => "abril",
210
- "05" => "mayo",
211
- "06" => "junio",
212
- "07" => "julio",
213
- "08" => "agosto",
214
- "09" => "septiembre",
215
- "10" => "octubre",
216
- "11" => "noviembre",
217
- "12" => "diciembre"
218
- }
219
- meses[mes]
220
- end
221
-
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(/-|\//)
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