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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba9fcac1112630d8abffc56ed845289ee430e9e35027fe23703868cf8134df1f
4
- data.tar.gz: c628263880863e9f0597841e4bc90bfc5b714edf19f612440579a862d78d7814
3
+ metadata.gz: 7bee7461787674a640e0984f0dc871abca95a8558994c2a089a5e13614ad0683
4
+ data.tar.gz: a0b0ca58eeb1a363f693c9e272d7e81ed5b7caad09beb76521574791adde5c53
5
5
  SHA512:
6
- metadata.gz: 4e5143b481b2365e97a21c919b42fe1b2ef2706d25c7273e80df901bccfc42ca10c055d73d0a98af7472b4e06d68a2f12806881d4a577b9803c6e9c0acf7329a
7
- data.tar.gz: e5bd5f89bd3bbfa780dfde8adef4838f19655865751753b341a47d9bcea99425e07648b97062db25eb9aaf01ec33370327a15e2a68476a1773c9b9235cc1b521
6
+ metadata.gz: b8efa448eaa46bf3ba8df4eb526a49114d40db63bb48ff4b16ff1702773f6f6e1e86f07486ad13afa98ea501f3289357441dfa4b20be92955a27805632615ff0
7
+ data.tar.gz: a9770b5ce2594f224bd035bee674acc51b36f7651aea70e3a7370bcb91f18dd5773bb63b34e9b3afb7c0b57248fdf2290c5adba3146a65651ddb551140b0b43c
@@ -0,0 +1,181 @@
1
+ require 'pg'
2
+ require 'fox16'
3
+ include Fox
4
+
5
+ class ActualizarAlumno < 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, "anio_lectivo: #{cambiar_formato_anio_lectivo(@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
+
27
+ # section datos
28
+ @lbl_anio_lectivo = FXLabel.new(self, 'Año lectivo', opts: LAYOUT_EXPLICIT, width: 250,
29
+ height: 20, x: 10, y: 150)
30
+ @lbl_anio_lectivo.backColor = FXRGB(3, 187, 133)
31
+ @input_anio_lectivo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
32
+ y: 150)
33
+ @input_anio_lectivo.text = @registro[12]
34
+ @lbl_nivel = FXLabel.new(self, 'Nivel: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
35
+ x: 680, y: 150)
36
+ @lbl_nivel.backColor = FXRGB(3, 187, 133)
37
+ @input_nivel = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
38
+ y: 150)
39
+ @input_nivel.text = @registro[10]
40
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
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: 510,
44
+ y: 180)
45
+ @input_sector.text = @registro[11]
46
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
47
+ y: 240)
48
+ @lbl_name.backColor = FXRGB(3, 187, 133)
49
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
50
+ y: 240)
51
+ @input_name.text = @registro[1]
52
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
53
+ y: 270)
54
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
55
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
56
+ y: 270)
57
+ @input_apellidos.text = @registro[2]
58
+ @lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
59
+ height: 20, x: 10, y: 300)
60
+ @lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
61
+ @input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
62
+ x: 170, y: 300)
63
+ @input_lugar_nacimiento.text = @registro[3]
64
+ @lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
65
+ width: 250, height: 20, x: 340, y: 300)
66
+ @lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
67
+ @input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
68
+ x: 590, y: 300)
69
+ @input_fecha_nacimiento.text = @registro[4]
70
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 80, height: 20, x: 750,
71
+ y: 300)
72
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
73
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
74
+ y: 300)
75
+ @input_cedula.text = @registro[5]
76
+ @lbl_nombres_catequista = FXLabel.new(self, 'Nombres Catequista: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
77
+ y: 330)
78
+ @lbl_nombres_catequista.backColor = FXRGB(3, 187, 133)
79
+ @input_nombres_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
80
+ y: 330)
81
+ @input_nombres_catequista.text = @registro[7]
82
+ @lbl_apellidos_catequista = FXLabel.new(self, 'Apellidos catequista: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
83
+ y: 360)
84
+ @lbl_apellidos_catequista.backColor = FXRGB(3, 187, 133)
85
+ @input_apellidos_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
86
+ y: 360)
87
+ @input_apellidos_catequista.text = @registro[8]
88
+ # create buttons
89
+ @btnupdate = FXButton.new(self, 'Actualizar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
90
+ x: 790, y: 400)
91
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
92
+ x: 900, y: 400)
93
+
94
+ # connect buttons
95
+ @btnupdate.connect(SEL_COMMAND) do
96
+ anio_lectivo = @input_anio_lectivo.text.empty? ? nil : @input_anio_lectivo.text
97
+ nivel = @input_nivel.text.empty? ? nil : @input_nivel.text
98
+ sector = @input_sector.text.empty? ? nil : @input_sector.text
99
+ name = @input_name.text.empty? ? nil : @input_name.text
100
+ apellidos = @input_apellidos.text.empty? ? nil : @input_apellidos.text
101
+ lugar_nacimiento = @input_lugar_nacimiento.text.empty? ? nil : @input_lugar_nacimiento.text
102
+ fecha_nacimiento = @input_fecha_nacimiento.text.empty? ? nil : @input_fecha_nacimiento.text
103
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
104
+ nombres_catequista = @input_nombres_catequista.text.empty? ? nil : @input_nombres_catequista.text
105
+ apellidos_catequista = @input_apellidos_catequista.text.empty? ? nil : @input_apellidos_catequista.text
106
+
107
+ # tables
108
+ # tabla catequistas (id, nombres, apellidos, fecha de nacimiento, lugar de nacimiento, cedula)
109
+ # tabla alumnos (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, fk_catequistas, fk_niveles)
110
+ # tabla niveles (id, nivel, sector, anio_lectivo)
111
+ # Iniciar una transacción
112
+ $conn.transaction do
113
+ # Actualizar la tabla catequistas
114
+ $conn.exec('UPDATE catequistas SET nombres = $1, apellidos = $2 WHERE id = $3',
115
+ [nombres_catequista, apellidos_catequista, registro[6]])
116
+
117
+ # Actualizar la tabla niveles
118
+ $conn.exec(
119
+ 'UPDATE niveles SET anio_lectivo = $1, nivel = $2, sector = $3 WHERE id = $4', [
120
+ anio_lectivo, nivel, sector, registro[9]
121
+ ]
122
+ )
123
+
124
+ # Actualizar la tabla alumnos
125
+ $conn.exec('UPDATE alumnos SET nombres = $1, apellidos = $2, lugar_nacimiento = $3, fecha_nacimiento = $4, cedula = $5 WHERE id = $6',
126
+ [name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, registro[0]])
127
+
128
+ # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
129
+ if FXMessageBox.question(self, MBOX_YES_NO, 'Pregunta', '¿Desea guardar los cambios?') == MBOX_CLICKED_YES
130
+ # Confirmar la transacción
131
+ $conn.exec('COMMIT')
132
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos actualizados correctamente')
133
+ else
134
+ $conn.exec('ROLLBACK')
135
+ end
136
+ close
137
+ end
138
+ end
139
+
140
+ @btncancel.connect(SEL_COMMAND) do
141
+ FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No se guardarán los cambios')
142
+ close
143
+ end
144
+ end
145
+
146
+ # Nombre del mes
147
+ def nombre_mes(mes)
148
+ meses = {
149
+ '01' => 'enero',
150
+ '02' => 'febrero',
151
+ '03' => 'marzo',
152
+ '04' => 'abril',
153
+ '05' => 'mayo',
154
+ '06' => 'junio',
155
+ '07' => 'julio',
156
+ '08' => 'agosto',
157
+ '09' => 'septiembre',
158
+ '10' => 'octubre',
159
+ '11' => 'noviembre',
160
+ '12' => 'diciembre'
161
+ }
162
+ meses[mes]
163
+ end
164
+
165
+ # Cambiar el formato de la anio_lectivo de YYYY-MM-DD a DD de nombre_mes de YYYY
166
+ def cambiar_formato_anio_lectivo(anio_lectivo)
167
+ # split "-" or "/"
168
+ anio_lectivo = anio_lectivo.split(%r{-|/})
169
+ # si el formato de anio_lectivo es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
170
+ if anio_lectivo[0].length == 4
171
+ "#{anio_lectivo[2]} de #{nombre_mes(anio_lectivo[1])} de #{anio_lectivo[0]}"
172
+ else
173
+ "#{anio_lectivo[0]} de #{nombre_mes(anio_lectivo[1])} de #{anio_lectivo[2]}"
174
+ end
175
+ end
176
+
177
+ def create
178
+ super
179
+ show(PLACEMENT_SCREEN)
180
+ end
181
+ end
@@ -0,0 +1,179 @@
1
+ require 'pg'
2
+ require 'fox16'
3
+ include Fox
4
+
5
+ class Alumno < FXMainWindow
6
+ def initialize(app)
7
+ @app = app
8
+ super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 330)
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
+
27
+ # section datos
28
+ @lbl_anio_lectivo = FXLabel.new(self, 'Año lectivo: ', opts: LAYOUT_EXPLICIT, width: 150,
29
+ height: 20, x: 10, y: 150)
30
+ @lbl_anio_lectivo.backColor = FXRGB(3, 187, 133)
31
+ @input_anio_lectivo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
32
+ y: 150)
33
+ @lbl_nivel = FXLabel.new(self, 'Nivel: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
34
+ x: 330, y: 150)
35
+ @lbl_nivel.backColor = FXRGB(3, 187, 133)
36
+ @input_nivel = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 490,
37
+ y: 150)
38
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 650,
39
+ y: 150)
40
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
41
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 810,
42
+ y: 150)
43
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
44
+ y: 180)
45
+ @lbl_name.backColor = FXRGB(3, 187, 133)
46
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
47
+ y: 180)
48
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 330,
49
+ y: 180)
50
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
51
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 490,
52
+ y: 180)
53
+ @lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
54
+ height: 20, x: 10, y: 210)
55
+ @lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
56
+ @input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
57
+ x: 170, y: 210)
58
+ @lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
59
+ width: 250, height: 20, x: 340, y: 210)
60
+ @lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
61
+ @input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
62
+ x: 590, y: 210)
63
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 80, height: 20, x: 750,
64
+ y: 210)
65
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
66
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
67
+ y: 210)
68
+ @lbl_nombre_catequista = FXLabel.new(self, 'Nombre del catequista: ', opts: LAYOUT_EXPLICIT, width: 150,
69
+ height: 20, x: 10, y: 240)
70
+ @lbl_nombre_catequista.backColor = FXRGB(3, 187, 133)
71
+ @input_nombre_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
72
+ x: 170, y: 240)
73
+ @lbl_apellidos_catequista = FXLabel.new(self, 'Apellidos del catequista: ', opts: LAYOUT_EXPLICIT, width: 150,
74
+ height: 20, x: 340, y: 240)
75
+ @lbl_apellidos_catequista.backColor = FXRGB(3, 187, 133)
76
+ @input_apellidos_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
77
+ x: 510, y: 240)
78
+ # create buttons
79
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
80
+ x: 790, y: 270)
81
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
82
+ x: 900, y: 270)
83
+
84
+ # connect buttons
85
+ @btnsave.connect(SEL_COMMAND) do
86
+ anio_lectivo = @input_anio_lectivo.text.empty? ? nil : @input_anio_lectivo.text
87
+ nivel = @input_nivel.text.empty? ? nil : @input_nivel.text
88
+ sector = @input_sector.text.empty? ? nil : @input_sector.text
89
+ name = @input_name.text.empty? ? nil : @input_name.text
90
+ apellidos = @input_apellidos.text.empty? ? nil : @input_apellidos.text
91
+ lugar_nacimiento = @input_lugar_nacimiento.text.empty? ? nil : @input_lugar_nacimiento.text
92
+ fecha_nacimiento = @input_fecha_nacimiento.text.empty? ? nil : @input_fecha_nacimiento.text
93
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
94
+ nombres_catequista = @input_nombre_catequista.text.empty? ? nil : @input_nombre_catequista.text
95
+ apellidos_catequista = @input_apellidos_catequista.text.empty? ? nil : @input_apellidos_catequista.text
96
+
97
+
98
+ # tables
99
+ # tabla catequistas (id, nombres, apellidos, fecha de nacimiento, lugar de nacimiento, cedula)
100
+ # tabla alumnos (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, fk_catequistas, fk_niveles)
101
+ # tabla niveles (id, nivel, sector, anio_lectivo)
102
+ $conn.transaction do
103
+ # Insertar en la tabla catequistas
104
+ @registro_catequistas = $conn.exec('INSERT INTO catequistas (nombres, apellidos) VALUES ($1, $2)',
105
+ [nombres_catequista, apellidos_catequista])
106
+ # Insertar en la tabla niveles
107
+ @registro_parroquias = $conn.exec('INSERT INTO niveles (anio_lectivo, nivel, sector) VALUES ($1, $2, $3)',
108
+ [anio_lectivo, nivel, sector])
109
+ # Insertar en la tabla alumnos
110
+ @registro_creyentes = $conn.exec(
111
+ 'INSERT INTO alumnos (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [
112
+ name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula
113
+ ]
114
+ )
115
+ puts @registro_creyentes
116
+ puts @registro_parroquias
117
+ puts @registro_catequistas
118
+
119
+ # Confirmar la transacción
120
+ $conn.exec('COMMIT')
121
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
122
+ clear_input_fields
123
+ end
124
+ end
125
+
126
+ @btncancel.connect(SEL_COMMAND) do
127
+ clear_input_fields
128
+ end
129
+
130
+ def clear_input_fields
131
+ @input_anio_lectivo.text = ''
132
+ @input_nivel.text = ''
133
+ @input_sector.text = ''
134
+ @input_name.text = ''
135
+ @input_apellidos.text = ''
136
+ @input_lugar_nacimiento.text = ''
137
+ @input_fecha_nacimiento.text = ''
138
+ @input_cedula.text = ''
139
+ @input_nombre_catequista.text = ''
140
+ @input_apellidos_catequista.text = ''
141
+ end
142
+ end
143
+
144
+ # Nombre del mes
145
+ def nombre_mes(mes)
146
+ meses = {
147
+ '01' => 'enero',
148
+ '02' => 'febrero',
149
+ '03' => 'marzo',
150
+ '04' => 'abril',
151
+ '05' => 'mayo',
152
+ '06' => 'junio',
153
+ '07' => 'julio',
154
+ '08' => 'agosto',
155
+ '09' => 'septiembre',
156
+ '10' => 'octubre',
157
+ '11' => 'noviembre',
158
+ '12' => 'diciembre'
159
+ }
160
+ meses[mes]
161
+ end
162
+
163
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
164
+ def cambiar_formato_fecha(fecha)
165
+ # split "-" or "/"
166
+ fecha = fecha.split(%r{-|/})
167
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
168
+ if fecha[0].length == 4
169
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
170
+ else
171
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
172
+ end
173
+ end
174
+
175
+ def create
176
+ super
177
+ show(PLACEMENT_SCREEN)
178
+ end
179
+ end
@@ -0,0 +1,119 @@
1
+ require 'pg'
2
+ require 'fox16'
3
+ include Fox
4
+
5
+ class Catecismo < FXMainWindow
6
+ def initialize(app)
7
+ super(app, 'Parroquia San Judas Tadeo', width: 700, height: 500)
8
+ @app = app
9
+ self.backColor = FXRGB(3, 187, 133)
10
+
11
+ # Font
12
+ @font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
13
+
14
+ # Inserar imagen del logo
15
+ @image = File.join(File.dirname(__FILE__), '../assets/images/Logo-SJT.png')
16
+ @image = File.open(@image, 'rb')
17
+ @image = FXPNGIcon.new(app, @image.read)
18
+ @logo = FXImageFrame.new(self, @image, opts: LAYOUT_EXPLICIT | LAYOUT_CENTER_X | LAYOUT_CENTER_Y, width: 400,
19
+ height: 250, x: 10, y: 100)
20
+ # Color de fondo de image frame es el mismo que el de la ventana
21
+ @logo.backColor = FXRGB(3, 187, 133)
22
+ # Escalar imagen
23
+ @image.scale(400, 250)
24
+
25
+ # Title
26
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
27
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700, height: 20, x: 0, y: 20)
28
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
29
+ @lbltitle.backColor = FXRGB(3, 187, 133)
30
+ # Subtitle
31
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
32
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700, height: 20, x: 0, y: 40)
33
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
34
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
35
+ # Date
36
+ @date = Time.now.strftime('%d/%m/%Y')
37
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
38
+ width: 700, height: 20, x: 0, y: 60, padRight: 20)
39
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
40
+ @lbldate.backColor = FXRGB(3, 187, 133)
41
+
42
+ # section lista
43
+ @btnalumno = FXButton.new(self, 'Ingresar Alumno', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 150,
44
+ height: 30, x: 460, y: 150)
45
+ @btnconsulta = FXButton.new(self, 'Consultar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 150,
46
+ height: 30, x: 460, y: 190)
47
+
48
+ # Footer
49
+ @lblfooter = FXLabel.new(self, 'WebMinds Studio - 2023', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700,
50
+ height: 20, x: 0, y: 400)
51
+ @lblfooter.font = FXFont.new(app, 'Geneva', 10)
52
+ @lblfooter.backColor = FXRGB(3, 187, 133)
53
+ @lblauthor = FXLabel.new(self, 'Desarrollado por Ing. Francisco J. Borja L.',
54
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700, height: 20, x: 0, y: 420)
55
+ @lblauthor.font = FXFont.new(app, 'Geneva', 10)
56
+ @lblauthor.backColor = FXRGB(3, 187, 133)
57
+ @lblweb = FXLabel.new(self, 'www.webmindsstudio.com', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700,
58
+ height: 20, x: 0, y: 440)
59
+ @lblweb.font = FXFont.new(app, 'Geneva', 10)
60
+ @lblweb.backColor = FXRGB(3, 187, 133)
61
+ @lbllicence = FXLabel.new(self, 'MIT License', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700,
62
+ height: 20, x: 0, y: 460)
63
+ @lbllicence.font = FXFont.new(app, 'Geneva', 10)
64
+ @lbllicence.backColor = FXRGB(3, 187, 133)
65
+ # section buttons executions
66
+ @btnalumno.connect(SEL_COMMAND) do
67
+ require_relative 'alumno'
68
+ vtnalumno = Alumno.new(@app)
69
+ vtnalumno.create
70
+ vtnalumno.show(PLACEMENT_SCREEN)
71
+ end
72
+ @btnconsulta.connect(SEL_COMMAND) do
73
+ require_relative 'consulta'
74
+ vtnconsulta = Consulta.new(@app)
75
+ vtnconsulta.create
76
+ vtnconsulta.show(PLACEMENT_SCREEN)
77
+ end
78
+ end
79
+
80
+ # Nombre del mes
81
+ def nombre_mes(mes)
82
+ meses = {
83
+ '01' => 'enero',
84
+ '02' => 'febrero',
85
+ '03' => 'marzo',
86
+ '04' => 'abril',
87
+ '05' => 'mayo',
88
+ '06' => 'junio',
89
+ '07' => 'julio',
90
+ '08' => 'agosto',
91
+ '09' => 'septiembre',
92
+ '10' => 'octubre',
93
+ '11' => 'noviembre',
94
+ '12' => 'diciembre'
95
+ }
96
+ meses[mes]
97
+ end
98
+
99
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
100
+ def cambiar_formato_fecha(fecha)
101
+ # split "-" or "/"
102
+ fecha = fecha.split(%r{-|/})
103
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
104
+ if fecha[0].length == 4
105
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
106
+ else
107
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
108
+ end
109
+ end
110
+
111
+ def create
112
+ super
113
+ show(PLACEMENT_SCREEN)
114
+ end
115
+ end
116
+
117
+ $conn = PG.connect(host: 'localhost', port: '5432', dbname: 'catecismo', user: 'postgres', password: 'postgres')
118
+ # Comprobar conexión con la base de datos
119
+ exit if $conn.status != PG::CONNECTION_OK
@@ -0,0 +1,177 @@
1
+ require 'pg'
2
+ require 'fox16'
3
+ include Fox
4
+
5
+ class Consulta < FXMainWindow
6
+ def initialize(app)
7
+ super(app, 'Parroquia San Judas Tadeo', width: 700, height: 380)
8
+ @app = app
9
+ self.backColor = FXRGB(3, 187, 133)
10
+
11
+ # seccion encabezado
12
+ # create label
13
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
14
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700, height: 20, x: 0, y: 20)
15
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
16
+ @lbltitle.backColor = FXRGB(3, 187, 133)
17
+ # create label
18
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - VICARIA NORTE SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
19
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700, height: 20, x: 0, y: 40)
20
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
21
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
22
+ # create label
23
+ @date = Time.now.strftime('%d/%m/%Y')
24
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)} ", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
25
+ width: 680, height: 20, x: 0, y: 60)
26
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
27
+ @lbldate.backColor = FXRGB(3, 187, 133)
28
+ # seccioan consulta
29
+ @lbl_consulta = FXLabel.new(self, 'Consultar por: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
30
+ x: 10, y: 150)
31
+ @lbl_consulta.backColor = FXRGB(3, 187, 133)
32
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos del alumno: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
33
+ y: 180)
34
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
35
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
36
+ y: 180)
37
+ @lbl_nombres = FXLabel.new(self, 'Nombres del alumno: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
38
+ y: 180)
39
+ @lbl_nombres.backColor = FXRGB(3, 187, 133)
40
+ @input_nombres = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
41
+ y: 180)
42
+ @lbl_cedula = FXLabel.new(self, 'Cédula del alumno: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
43
+ y: 210)
44
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
45
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
46
+ y: 210)
47
+ @lbl_anio_lectivo = FXLabel.new(self, 'Año lectivo: ', opts: LAYOUT_EXPLICIT, width: 150,
48
+ height: 20, x: 10, y: 240)
49
+ @lbl_anio_lectivo.backColor = FXRGB(3, 187, 133)
50
+ @input_anio_lectivo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
51
+ y: 240)
52
+ @lbl_nivel = FXLabel.new(self, 'Nivel: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
53
+ x: 330, y: 240)
54
+ @lbl_nivel.backColor = FXRGB(3, 187, 133)
55
+ @input_nivel = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 490,
56
+ y: 240)
57
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
58
+ x: 10, y: 270)
59
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
60
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
61
+ y: 270)
62
+ @lbl_nombres_catequista = FXLabel.new(self, 'Nombres catequista: ', opts: LAYOUT_EXPLICIT, width: 150,
63
+ height: 20, x: 10, y: 300)
64
+ @lbl_nombres_catequista.backColor = FXRGB(3, 187, 133)
65
+ @input_nombres_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
66
+ y: 300)
67
+ @lbl_apellidos_catequista = FXLabel.new(self, 'Apellidos catequista: ', opts: LAYOUT_EXPLICIT, width: 150,
68
+ height: 20, x: 330, y: 300)
69
+ @lbl_apellidos_catequista.backColor = FXRGB(3, 187, 133)
70
+ @input_apellidos_catequista = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 490,
71
+ y: 300)
72
+
73
+ # create buttons
74
+ @btnsearch = FXButton.new(self, 'Buscar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
75
+ x: 450, y: 330)
76
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
77
+ x: 560, y: 330)
78
+
79
+ # connect buttons
80
+ @btnsearch.connect(SEL_COMMAND) do
81
+ apellidos = @input_apellidos.text
82
+ nombres = @input_nombres.text
83
+ cedula = @input_cedula.text
84
+ anio_lectivo = @input_anio_lectivo.text
85
+ nivel = @input_nivel.text
86
+ sector = @input_sector.text
87
+ nombres_catequista = @input_nombres_catequista.text
88
+ apellidos_catequista = @input_apellidos_catequista.text
89
+
90
+ if apellidos.empty? && nombres.empty? && cedula.empty? && anio_lectivo.empty? && nivel.empty? && nombres_catequista.empty? && apellidos_catequista.empty? && sector.empty?
91
+ FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'Debe ingresar al menos un criterio de búsqueda')
92
+ else
93
+ # conectar a la base de datos
94
+ # tables
95
+ # tabla catequistas (id, nombres, apellidos, fecha de nacimiento, lugar de nacimiento, cedula)
96
+ # tabla alumnos (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, fk_catequistas, fk_niveles)
97
+ # tabla niveles (id, nivel, sector, anio_lectivo)
98
+ sql = 'SELECT * FROM alumnos INNER JOIN niveles ON alumnos.id = niveles.id INNER JOIN catequistas ON alumnos.id = catequistas.id'
99
+ sql += " WHERE alumnos.apellidos LIKE '%#{apellidos}%'" unless apellidos.empty?
100
+ sql += " AND alumnos.nombres LIKE '%#{nombres}%'" unless nombres.empty?
101
+ sql += " AND alumnos.cedula = '#{cedula}'" unless cedula.empty?
102
+ sql += " AND niveles.anio_lectivo = '#{anio_lectivo}'" unless anio_lectivo.empty?
103
+ sql += " AND niveles.nivel = '#{nivel}'" unless nivel.empty?
104
+ sql += " AND catequistas.nombres LIKE '%#{nombres_catequista}%'" unless nombres_catequista.empty?
105
+ sql += " AND catequistas.apellidos LIKE '%#{apellidos_catequista}%'" unless apellidos_catequista.empty?
106
+ # Se escoge año lectivo, sector, catequista y nivel
107
+ unless anio_lectivo.empty? || nivel.empty? || nombres_catequista.empty? || apellidos_catequista.empty?
108
+ sql += " AND niveles.anio_lectivo = '#{anio_lectivo}' AND niveles.nivel = '#{nivel}' AND catequistas.nombres LIKE '%#{nombres_catequista}%' AND catequistas.apellidos LIKE '%#{apellidos_catequista}%'"
109
+ end
110
+
111
+
112
+ $conn.exec(sql) do |result|
113
+ if result.values.empty?
114
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'No se encontraron registros')
115
+ else
116
+ # mostrar resultados
117
+ FXMessageBox.information(self, MBOX_OK, 'Información', "Se encontraron #{result.values.length} registros")
118
+ require_relative 'resultado'
119
+ vtnresultados = ResultadosConsulta.new(@app, result.values)
120
+ vtnresultados.create
121
+ vtnresultados.show(PLACEMENT_SCREEN)
122
+ end
123
+ end
124
+ end
125
+ end
126
+
127
+ @btncancel.connect(SEL_COMMAND) do
128
+ clear_input_fields
129
+ end
130
+
131
+ def clear_input_fields
132
+ @input_apellidos.text = ''
133
+ @input_nombres.text = ''
134
+ @input_cedula.text = ''
135
+ @input_anio_lectivo.text = ''
136
+ @input_nivel.text = ''
137
+ @input_nombres_catequista.text = ''
138
+ @input_apellidos_catequista.text = ''
139
+ end
140
+ end
141
+
142
+ # Nombre del mes
143
+ def nombre_mes(mes)
144
+ meses = {
145
+ '01' => 'enero',
146
+ '02' => 'febrero',
147
+ '03' => 'marzo',
148
+ '04' => 'abril',
149
+ '05' => 'mayo',
150
+ '06' => 'junio',
151
+ '07' => 'julio',
152
+ '08' => 'agosto',
153
+ '09' => 'septiembre',
154
+ '10' => 'octubre',
155
+ '11' => 'noviembre',
156
+ '12' => 'diciembre'
157
+ }
158
+ meses[mes]
159
+ end
160
+
161
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
162
+ def cambiar_formato_fecha(fecha)
163
+ # split "-" or "/"
164
+ fecha = fecha.split(%r{-|/})
165
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
166
+ if fecha[0].length == 4
167
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
168
+ else
169
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
170
+ end
171
+ end
172
+
173
+ def create
174
+ super
175
+ show(PLACEMENT_SCREEN)
176
+ end
177
+ end