Skip to content

Commit

Permalink
Commit partial reports option
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosforero committed Nov 4, 2010
1 parent 310e8e0 commit 3ddfb03
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
10 changes: 10 additions & 0 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class ReportsController < ApplicationController

def index
@periods = Period.all(:limit=>20)
@units = Unit.all(:limit=>20)
@projects = Project.all(:limit=>20)
@journal_types = JournalType.all(:limit=>20)
end

end
2 changes: 2 additions & 0 deletions app/helpers/reports_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ReportsHelper
end
2 changes: 2 additions & 0 deletions app/models/report.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Report < ActiveRecord::Base
end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

<li><%= link_to t(:paycheck_periods, :scope => :layout), paycheck_periods_path %></li>
<li><%= link_to t(:weekly_sales, :scope => :layout), weekly_sales_path %></li>

<li><%= link_to t(:reports, :scope => :layout), reports_path %></li>
<li>
<%= t(:logged_in_as, :scope => :layout) -%> <%= current_user.email %> (<%= link_to t(:log_out, :scope => :layout), destroy_user_session_path %>)
</li>
Expand Down
78 changes: 78 additions & 0 deletions app/views/reports/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<h1>
<%= t(:title_plural, :scope=>:reports) %>
</h1>

<div class="form_header">

<table>
<tbody>
<tr>
<td>
<%= t(:from_period, :scope=>:reports) %>
</td>
<td>
<%= select_tag :from_period_id,
options_from_collection_for_select(@periods, "id", "to_s") %>
</td>
<td>
<%= t(:to_period, :scope=>:reports) %>
</td>
<td>
<%= select_tag :to_period_id,
options_from_collection_for_select(@periods, "id", "to_s") %>
</td>
<td>
<%= t(:result_from_period, :scope=>:reports) %>
</td>
<td>
<%= select_tag :result_from_period_id,
options_from_collection_for_select(@periods, "id", "to_s") %>
</td>
</tr>
<tr>
<td>
<%= t(:unit, :scope=>:reports) %>
</td>
<td>
<%= select_tag :unit_id,
options_from_collection_for_select(@units, "id", "to_s") %>
</td>
<td>
<%= t(:project, :scope=>:reports) %>
</td>
<td>
<%= select_tag :project_id,
options_from_collection_for_select(@projects, "id", "to_s") %>
</td>
<td>
<%= t(:journal_type, :scope=>:reports) %>
</td>
<td>
<%= select_tag :journal_type_id,
options_from_collection_for_select(@journal_types, "id", "to_s") %>
</td>
</tr>
<tr>
<td>
<%= t(:show_only_active_accounts, :scope=>:reports) %>
</td>
<td>
<%= check_box_tag :show_only_active_accounts %>
</td>
<td>
<%= t(:last_year_figures, :scope=>:reports) %>
</td>
<td>
<%= check_box_tag :last_year_figures %>
</td>
<td>
<%= t(:budget, :scope=>:reports) %>
</td>
<td>
<%= check_box_tag :budget %>
</td>
</tr>
</tbody>
</table>

</div>
39 changes: 39 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
set :application, "lodo"
set :use_sudo, false

set :ssh_options, { :forward_agent => true }

set :scm, :git
set :git_shallow_clone, 1


desc "Deploying to production: cap dev deploy:migrations"
task :dev do
set :repository, "ssh://[email protected]/var/gits/lodo_n.git"
set :deploy_to, "/var/www/lodo_dev/"
set :branch, "working"
role :app, "dev.dodo.lodo.no"
role :web, "dev.dodo.lodo.no"
role :db, "dev.dodo.lodo.no", :primary => true

end

desc "Deploying to staging server: cap staging deploy:migrations"
task :staging do
set :deploy_to, "/var/www/lodo_staging/"
role :app, "dev.dodo.lodo.no"
role :web, "dev.dodo.lodo.no"
role :db, "dev.dodo.lodo.no", :primary => true
end

#after("deploy:update_code") do
# run "/bin/chown -R www-data:www-data #{deploy_to}"
#end

namespace :deploy do
desc "Restart application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
end

16 changes: 13 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ en:
products: "Products"
orders: "Orders"
bills: "Bills"
reports: "Reports"
logged_in_as: "Logged in as"
log_out: "Log out"
active_company: "Active company"
Expand Down Expand Up @@ -96,7 +97,7 @@ en:
login_error: Login failed
logged_out: You are now logged out
password_sent: A new password has been sent by email
password_not_sent: Couldn't send password. Please try again later, or contact support.
password_not_sent: "Couldn't send password. Please try again later, or contact support."
password_changed: Password changed
update_success: User was successfully updated
accounts:
Expand Down Expand Up @@ -335,8 +336,17 @@ en:
z_amount: Z amount
date_shift: Date



reports:
title_plural: Reports
from_period: From Period
to_period: To Period
project: Project
unit: Department
show_only_active_accounts: Show Only Active Acount
last_year_figures: Last Year Figures
result_from_period: Results From
journal_type: Journal Type
budget: Budget



Expand Down
11 changes: 10 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Lodo::Application.routes.draw do |map|
Lodo::Application.routes.draw do |map|

# resources :weekly_sales

resources :weekly_sale_setup_product_groups
Expand Down Expand Up @@ -51,6 +52,14 @@
resources :accounts do
resources :ledgers
end

#Reports
resources :reports, :only=>[:index] do
collection do
get :ledger_balance
end
end


match 'welcome/current_company' => 'welcome#current_company', :as => :change_company

Expand Down
12 changes: 12 additions & 0 deletions db/migrate/20101103200244_create_reports.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateReports < ActiveRecord::Migration
def self.up
create_table :reports do |t|

t.timestamps
end
end

def self.down
drop_table :reports
end
end
11 changes: 11 additions & 0 deletions test/fixtures/reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
8 changes: 8 additions & 0 deletions test/functional/reports_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'test_helper'

class ReportsControllerTest < ActionController::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
4 changes: 4 additions & 0 deletions test/unit/helpers/reports_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test_helper'

class ReportsHelperTest < ActionView::TestCase
end
8 changes: 8 additions & 0 deletions test/unit/report_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'test_helper'

class ReportTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end

0 comments on commit 3ddfb03

Please sign in to comment.