From 41bb25788c492027953ca69de714879f226ba5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Fri, 31 May 2019 18:32:00 -0500 Subject: [PATCH] Actualiza --- Gemfile.lock | 8 +++--- .../buscarrepetidos/_restofiltro.html.erb | 0 .../controllers/buscarrepetidos_controller.rb | 26 ++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 app/views/sivel2_gen/buscarrepetidos/_restofiltro.html.erb diff --git a/Gemfile.lock b/Gemfile.lock index bdd56e43e..a1dcf6a43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/pasosdeJesus/heb412_gen.git - revision: 4c5db2b827f3c7bfc0309b03143167e9797ed234 + revision: b898f59243fdfdac4f7e910ee256288e13527fe1 specs: heb412_gen (1.0.b6) chosen-rails @@ -11,7 +11,7 @@ GIT GIT remote: https://github.com/pasosdeJesus/sip.git - revision: bb110a5560b9c0ff758da2980051d35e4c250320 + revision: f0e277f70d570a5d990f847289f846c11c5c04f8 specs: sip (2.0.b6) bootstrap-datepicker-rails @@ -107,7 +107,7 @@ GEM tzinfo (~> 1.1) zeitwerk (~> 2.1, >= 2.1.4) andand (1.3.3) - bcrypt (3.1.12) + bcrypt (3.1.13) bindex (0.7.0) bootsnap (1.4.4) msgpack (~> 1.0) @@ -315,7 +315,7 @@ GEM activemodel (>= 6.0.0.a) bindex (>= 0.4.0) railties (>= 6.0.0.a) - webpacker (4.0.5) + webpacker (4.0.6) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) diff --git a/app/views/sivel2_gen/buscarrepetidos/_restofiltro.html.erb b/app/views/sivel2_gen/buscarrepetidos/_restofiltro.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb b/lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb index 0669cd73b..67141fd8d 100644 --- a/lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb +++ b/lib/sivel2_gen/concerns/controllers/buscarrepetidos_controller.rb @@ -14,7 +14,31 @@ def reportar @titulo = 'Reporte de Repetidos' @repetidos = [] - rf="AND c1.fecha>='2010-05-01' AND c2.fecha>='2010-05-01'" + rf="" + + if (params[:buscarrepetido] && + params[:buscarrepetido][:fechaini] && + params[:buscarrepetido][:fechaini] != '') + pfi = params[:buscarrepetido][:fechaini] + if Rails.application.config.x.formato_fecha == 'dd-mm-yyyy' + pfid = Date.strptime(pfi, '%d-%m-%Y') + else + pfid = Date.strptime(pfi, '%Y-%m-%d') + end + rf += " AND c1.fecha >= #{pfid.strftime('%Y-%m-%d')}" + + " AND c2.fecha >= #{pfid.strftime('%Y-%m-%d')}" + end + if(params[:buscarrepetido] && params[:buscarrepetido][:fechafin] && + params[:buscarrepetido][:fechafin] != '') + pff = params[:buscarrepetido][:fechafin] + if Rails.application.config.x.formato_fecha == 'dd-mm-yyyy' + pffd = Date.strptime(pff, '%d-%m-%Y') + else + pffd = Date.strptime(pff, '%Y-%m-%d') + end + rf += " AND c1.fecha <= #{pfid.strftime('%Y-%m-%d')}" + + " AND c2.fecha <= #{pfid.strftime('%Y-%m-%d')}" + end res = Sivel2Gen::Caso.connection.select_all(" SELECT DISTINCT gr FROM (SELECT id, ARRAY(SELECT id FROM sivel2_gen_caso AS c2