parroquia 1.1.29 → 1.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 407b3f1b11e48a1dd3112e2516041f8fef1f1ebb78d2cfda9deb9f91a12d32d1
4
- data.tar.gz: 3d93a1b9e13e58dd83cba2b0c2dbde596d6d2616365edd507b19ee45521e0da8
3
+ metadata.gz: 6495f614e5e8d513e19b1495d68ef9c524b2ffd63f547bd48dc0fde367493bda
4
+ data.tar.gz: 644ea9ee67e656a430f596248c40acbe3ae6b8035392d794b387c6ea398c1bbc
5
5
  SHA512:
6
- metadata.gz: c79d138ea66fd741f3a6c956b1ebe84de44d6947487878a92c0ab366c3c8dc68c3601e76b7554bfc5045e16887b454944547010e9ceeedab8c6c14df94041e6f
7
- data.tar.gz: f1f0ade44f0193d24c24275e3981069a49b874d74accf12a45a464217672a57d21ede12e50f27f3bbf24e8fcf8ad1138c96c2351047a89c5312945ddbd329971
6
+ metadata.gz: ecb0e740466c44d613b5e3c26758d4431ce07c8ea7d7951bcf80bea9b5bd32edfd8d32504f0973139d75e5e54f8d6f2af96a7fc74c8ac5dc577c2809607ab88c
7
+ data.tar.gz: 66b176a74d73f88c9e338fed8851d1eaaff6f031cfa351abb93582cfc861f9a6752e3149a95beaff8c08efea9fb0c1f8a628f87b0b3fb7b54011ba614937dc5e
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'pg'
4
4
  require 'fox16'
5
+ require 'prawn'
5
6
  include Fox
6
7
 
7
8
  class Home < FXMainWindow
@@ -46,6 +47,8 @@ class Home < FXMainWindow
46
47
  height: 30, x: 460, y: 150)
47
48
  @btncatecismo = FXButton.new(self, 'Catecismo', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 150,
48
49
  height: 30, x: 460, y: 190)
50
+ @btnencabezado = FXButton.new(self, 'Encabezado', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 150,
51
+ height: 30, x: 460, y: 230)
49
52
 
50
53
  # Footer
51
54
  @lblfooter = FXLabel.new(self, 'WebMinds Studio - 2023', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 700,
@@ -77,8 +80,43 @@ class Home < FXMainWindow
77
80
  vtncatecismo.create
78
81
  vtncatecismo.show(PLACEMENT_SCREEN)
79
82
  end
83
+ @btnencabezado.connect(SEL_COMMAND) do
84
+ seleccionar_directorio
85
+ imprimir_pdf
86
+ end
87
+ end
88
+
89
+ def seleccionar_directorio
90
+ dialog = FXDirDialog.new(self, 'Seleccionar directorio para guardar PDF')
91
+ return unless dialog.execute != 0
92
+ directorio = dialog.getDirectory
93
+ @archivo_pdf = "#{directorio}/Encabezado.pdf"
80
94
  end
81
95
 
96
+ def imprimir_pdf
97
+ # Genera el archivo PDF
98
+ Prawn::Document.generate(@archivo_pdf, margin: [100, 100, 100, 100]) do |pdf|
99
+ pdf.font 'Helvetica'
100
+ pdf.font_size 12
101
+ # Definir tres casos en los que se puede imprimir el certificado y los distintos formatos para bautismo, confirmación y matrimonio
102
+ # Bautismo
103
+ # Encabezado
104
+ pdf.image File.join(File.dirname(__FILE__), './assets/images/arquidiocesisquito.png'), height: 80,
105
+ position: :absolute, at: [-60, 680]
106
+ pdf.text_box 'Arquidiócesis de Quito', align: :center, size: 16, style: :bold, at: [10, 670],
107
+ width: pdf.bounds.width
108
+ pdf.text_box 'Parroquia Eclesiástica "San Judas Tadeo"', align: :center, size: 14, style: :bold,
109
+ at: [10, 650], width: pdf.bounds.width
110
+ pdf.text_box "Jaime Roldós Aguilera, calle Oe13A y N82\nEl Condado, Quito - Ecuador\nTeléfono: 02496446",
111
+ align: :center, size: 10, at: [10, 630], width: pdf.bounds.width
112
+ pdf.image File.join(File.dirname(__FILE__), './assets/images/sanjudastadeo.png'), height: 80,
113
+ position: :absolute, at: [430, 680]
114
+ # Abre el archivo PDF con el visor de PDF predeterminado del sistema
115
+ system("xdg-open '#{@archivo_pdf}'")
116
+ # Mensaje de confirmación
117
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'El archivo PDF se ha generado correctamente')
118
+ end
119
+ end
82
120
  # Nombre del mes
83
121
  def nombre_mes(mes)
84
122
  meses = {
@@ -136,7 +136,7 @@ class ActualizarPreBautismal < FXMainWindow
136
136
  cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
137
137
  padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
138
138
  cedula_padrino = @input_cedula_padrino.text.empty? ? nil : @input_cedula_padrino.text
139
- madrina = @input_madrina.text.empty? ? nil : @input_madrina.
139
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
140
140
  cedula_madrina = @input_cedula_madrina.text.empty? ? nil : @input_cedula_madrina.text
141
141
  certifica = @input_certifica.text.empty? ? nil : @input_certifica.text
142
142
 
@@ -143,7 +143,7 @@ class ActualizarPreMatrimonial < FXMainWindow
143
143
  # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
144
144
  $conn.transaction do
145
145
  $conn.exec(
146
- 'UPDATE sacramentos SET sacramento = $1, fecha = $2, certifica = $3, testigo_novio = $4, testigo_novia = $5, nombres_novia = $6, apellidos_novia = $7, cedula_novia = $8 WHERE id = $10', [
146
+ 'UPDATE sacramentos SET sacramento = $1, fecha = $2, certifica = $3, testigo_novio = $4, testigo_novia = $5, nombres_novia = $6, apellidos_novia = $7, cedula_novia = $8 WHERE id = $9', [
147
147
  sacramento, fecha, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia, registro[0]
148
148
  ]
149
149
  )
@@ -209,10 +209,18 @@ class ResultadosConsulta < FXMainWindow
209
209
  if registros_seleccionados.nil? || registros_seleccionados.empty?
210
210
  FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No hay registros seleccionados')
211
211
  else
212
- @archivo_pdf = "#{directorio}/#{registros_seleccionados[0][23]} #{registros_seleccionados[0][24]} - #{registros_seleccionados[0][1]}.pdf"
212
+ name_part_1 = registros_seleccionados[0][23] || "" # Check if nil and provide a default value
213
+ name_part_2 = registros_seleccionados[0][24] || ""
214
+ name_part_3 = registros_seleccionados[0][1] || ""
215
+
216
+ @archivo_pdf = "#{directorio}/#{sanitize_file_name(name_part_1)} #{sanitize_file_name(name_part_2)} - #{sanitize_file_name(name_part_3)}.pdf"
213
217
  end
214
218
  end
215
219
 
220
+ def sanitize_file_name(name)
221
+ name.gsub(/[^0-9a-zA-Z_\s]/, '_')
222
+ end
223
+
216
224
  def imprimir_pdf
217
225
  if registros_seleccionados.empty?
218
226
  FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'Debe seleccionar al menos un registro')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parroquia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.29
4
+ version: 1.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Javier Borja Lobato