Permalink
Browse files

Merge branch 'master' of git://github.com/javiersuazo/ADS

  • Loading branch information...
2 parents 7106b23 + d4b6761 commit 2864e1dd72bb9c59725f830e14e0667aa22f3e5d @jmatute committed Dec 8, 2011
View
2 SIELHO/Gemfile
@@ -4,6 +4,8 @@ gem 'rails', '3.0.1'
gem 'json'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
+#gem 'simple_xlsx'
+gem 'fastercsv'
gem "rake","0.8.7"
gem 'thin'
gem 'devise'
View
2 SIELHO/Gemfile.lock
@@ -41,6 +41,7 @@ GEM
erubis (2.6.6)
abstract (>= 1.0.0)
eventmachine (0.12.10)
+ fastercsv (1.5.4)
formtastic (2.0.2)
rails (~> 3.0)
i18n (0.4.2)
@@ -97,6 +98,7 @@ PLATFORMS
DEPENDENCIES
devise
+ fastercsv
formtastic
json
paperclip (~> 2.4)
View
6 SIELHO/app/controllers/estadisticas_controller.rb
@@ -0,0 +1,6 @@
+class EstadisticasController < ApplicationController
+ def index
+ Solicitud.export_users
+ end
+
+end
View
2 SIELHO/app/helpers/estadisticas_helper.rb
@@ -0,0 +1,2 @@
+module EstadisticasHelper
+end
View
19 SIELHO/app/models/solicitud.rb
@@ -1,4 +1,23 @@
class Solicitud < ActiveRecord::Base
+ require 'fastercsv'
+
+
+ def self.export_users
+ csv_string = FasterCSV.generate do |csv|
+
+ cols = ["column one", "column two", "column three"]
+
+ csv << cols
+
+ User.all.each do |entry|
+ csv << [entry.email, entry.email, entry.id ]
+ end
+
+ filename = "data-#{Time.now.to_date.to_s}.csv"
+ send_data(csv_string, :type => 'text/csv; charset=utf-8; header=present', :filename => filename)
+
+ end
+ end
def self.buscar(codigo,institucion,incio,final)
solicitudes = []
View
20 SIELHO/app/views/estadisticas/index.html.erb
@@ -0,0 +1,20 @@
+<h2 class= "titulo">Estadisticas</h2>
+<h4 class= "titulo"> Seleccione los parametros para realizar el reporte</h4>
+
+<div class= "buscarForm">
+<% form_tag estadisticas_index_path, :method => 'get' do %>
+ <table>
+ <tr>
+ <td><p>Ingrese el codigo de la solicitud:</p> <%= text_field_tag :search, params[:search] %><td/>
+
+ <td><p>Desde:</p> <input type="text" name = "final" size="12" id="inputField" /> <td/>
+ <td><p>Hasta:</p> <input type="text" name ="inicio" size="12" id="inputField2" /> <td/>
+
+<td> <p> Seleccion Institucion Obligada: </p> <%= collection_select(:institucion,:institucion, Institucion.all, :id, :nombre) %><td/>
+ </tr>
+ </table>
+
+ <br/> <%= submit_tag "Search", :name => nil %><br/>
+
+<% end %>
+</div>
View
2 SIELHO/app/views/estadisticas/index.html.erb~
@@ -0,0 +1,2 @@
+<h2 class= "titulo">Estadisticas</h2>
+<h4 class= "titulo"> Seleccione los parametros para realizar el reporte</h4>
View
7 SIELHO/app/views/layouts/application.html.erb
@@ -253,6 +253,13 @@ o con el administrador del sistema</p>
<span><p>Buscar</p></span>
<%= link_to image_tag("/images/search.png"), buscar_path%>
</li>
+
+ <li class="active">
+
+ <span><p>Estadisticas</p></span>
+ <%= link_to image_tag("/images/stadisticas.png"), estadisticas_index_path%>
+ </li>
+
<li class="active">
<span><p>Logout</p></span>
<%= link_to image_tag("/images/logout.png"), destroy_user_session_path %>
View
29 SIELHO/app/views/layouts/application.html.erb~
@@ -30,34 +30,19 @@
useMode:2,
target:"inputField2",
- /*selectedDate:{ This is an example of what the full configuration offers.
- day:5, For full documentation about these settings please see the full version of the code.
- month:9,
- year:2006
- },
- yearsRange:[1978,2020],
- limitToToday:false,
- cellColorScheme:"beige",
- dateFormat:"%m-%d-%Y",
- imgPath:"img/",
- weekStartDay:1*/
+
+ yearsRange:[2011,2020],
+ limitToToday:true,
+ cellColorScheme:"beige"
});
new JsDatePick({
useMode:2,
target:"inputField",
- /*selectedDate:{ This is an example of what the full configuration offers.
- day:5, For full documentation about these settings please see the full version of the code.
- month:9,
- year:2006
- },
- yearsRange:[1978,2020],
- limitToToday:false,
- cellColorScheme:"beige",
- dateFormat:"%m-%d-%Y",
- imgPath:"img/",
- weekStartDay:1*/
+ yearsRange:[2011,2020],
+ limitToToday:true,
+ cellColorScheme:"beige"
});
};
</script>
View
1 SIELHO/config/initializers/task_scheduler.rb
@@ -5,6 +5,7 @@
scheduler = Rufus::Scheduler.start_new
## It will print message every i minute
+
scheduler.every("1m") do
#AplicationMailer.enviarcorreo("javier_suazo@live.com").deliver
a = File.open("public/plazo","r")
View
2 SIELHO/config/routes.rb
@@ -1,4 +1,6 @@
SIELHO::Application.routes.draw do
+ get "estadisticas/index"
+
get "buscar/index"
match "/buscar" => "buscar#index"
View
BIN SIELHO/public/images/stadisticas.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 SIELHO/test/functional/estadisticas_controller_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class EstadisticasControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ end
+
+end
View
4 SIELHO/test/unit/helpers/estadisticas_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class EstadisticasHelperTest < ActionView::TestCase
+end

0 comments on commit 2864e1d

Please sign in to comment.