diff --git a/app/views/plutus/accounts/index.html.erb b/app/views/plutus/accounts/index.html.erb index 831dc11c..3a3efe72 100644 --- a/app/views/plutus/accounts/index.html.erb +++ b/app/views/plutus/accounts/index.html.erb @@ -17,9 +17,9 @@ "> <%=h account.name %> <%=h account.type.sub('Plutus::','') %> - <%=h account.credits_balance %> - <%=h account.debits_balance %> - <%=h account.balance %> + <%=h account.credits_balance.round(2) %> + <%=h account.debits_balance.round(2) %> + <%=h account.balance.round(2) %> <% end %> diff --git a/app/views/plutus/entries/index.html.erb b/app/views/plutus/entries/index.html.erb index 0e26c352..9ac572ec 100644 --- a/app/views/plutus/entries/index.html.erb +++ b/app/views/plutus/entries/index.html.erb @@ -24,7 +24,7 @@ <% entry.debit_amounts.each do |debit_amount| %> ">     <%=h "#{debit_amount.account.name}" %> - <%=h debit_amount.amount %> + <%=h debit_amount.amount.round(2) %> @@ -33,7 +33,7 @@ ">         <%=h "#{credit_amount.account.name}" %> - <%=h credit_amount.amount %> + <%=h credit_amount.amount.round(2) %> <% end %> diff --git a/app/views/plutus/reports/_account.html.erb b/app/views/plutus/reports/_account.html.erb index 02a4abfb..419bb889 100644 --- a/app/views/plutus/reports/_account.html.erb +++ b/app/views/plutus/reports/_account.html.erb @@ -8,12 +8,21 @@ <% if accounts.count > 0%> + <% running_total = 0 %> <% accounts.each do |account| %> + <% balance = account.balance(:from_date => @from_date, :to_date => @to_date) %> "> <%=h account.name %> - <%=h account.balance(:from_date => @from_date, :to_date => @to_date) %> + <%=h balance.round(2) %> + <% running_total += balance %> <% end %> + "> + + Total <%= name %> + <%= running_total.round(2) %> + + <% end %> diff --git a/fixture_rails_root/Gemfile b/fixture_rails_root/Gemfile index a3456964..fc0f2504 100644 --- a/fixture_rails_root/Gemfile +++ b/fixture_rails_root/Gemfile @@ -1,33 +1,20 @@ source 'http://rubygems.org' -gem 'rails', '3.1.0' - -# Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' - +gem 'plutus', path: '../' +gem 'rails', '>= 4.0' gem 'sqlite3' - - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', " ~> 3.1.0" - gem 'coffee-rails', "~> 3.1.0" - gem 'uglifier' -end - gem 'jquery-rails' +gem 'jquery-ui-rails' -# Use unicorn as the web server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug19', :require => 'ruby-debug' +gem 'sass-rails' +gem 'coffee-rails' +gem 'uglifier' group :test do # Pretty printed test output gem 'turn', :require => false end + +group :development do + gem 'web-console', '~> 2.0' +end diff --git a/fixture_rails_root/Gemfile.lock b/fixture_rails_root/Gemfile.lock index 6aa8ef05..39c1f81c 100644 --- a/fixture_rails_root/Gemfile.lock +++ b/fixture_rails_root/Gemfile.lock @@ -1,120 +1,154 @@ +PATH + remote: ../ + specs: + plutus (0.12.0) + jquery-rails (~> 3.0) + jquery-ui-rails (~> 4.0) + rails (~> 4.0) + GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.0) - actionpack (= 3.1.0) - mail (~> 2.3.0) - actionpack (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - builder (~> 3.0.0) + actionmailer (4.2.4) + actionpack (= 4.2.4) + actionview (= 4.2.4) + activejob (= 4.2.4) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.4) + actionview (= 4.2.4) + activesupport (= 4.2.4) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.4) + activesupport (= 4.2.4) + builder (~> 3.1) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.0.3) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.0) - activemodel (3.1.0) - activesupport (= 3.1.0) - bcrypt-ruby (~> 3.0.0) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - arel (~> 2.2.1) - tzinfo (~> 0.3.29) - activeresource (3.1.0) - activemodel (= 3.1.0) - activesupport (= 3.1.0) - activesupport (3.1.0) - multi_json (~> 1.0) - ansi (1.4.2) - arel (2.2.3) - bcrypt-ruby (3.0.1) - builder (3.0.0) - coffee-rails (3.1.1) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.4) + activesupport (= 4.2.4) + globalid (>= 0.3.0) + activemodel (4.2.4) + activesupport (= 4.2.4) + builder (~> 3.1) + activerecord (4.2.4) + activemodel (= 4.2.4) + activesupport (= 4.2.4) + arel (~> 6.0) + activesupport (4.2.4) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + ansi (1.5.0) + arel (6.0.3) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) - railties (~> 3.1.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.3.1) + coffee-script-source (1.9.1.1) + debug_inspector (0.0.2) erubis (2.7.0) - execjs (1.3.2) - multi_json (~> 1.0) - hike (1.2.1) - i18n (0.6.0) - jquery-rails (1.0.19) - railties (~> 3.0) - thor (~> 0.14) - json (1.7.3) - mail (2.3.3) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.18) - multi_json (1.3.5) - polyglot (0.3.3) - rack (1.3.6) - rack-cache (1.0.3) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) + execjs (2.6.0) + globalid (0.3.6) + activesupport (>= 4.1.0) + i18n (0.7.0) + jquery-rails (3.1.4) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (4.2.1) + railties (>= 3.2.16) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mime-types (2.6.1) + mini_portile (0.6.2) + minitest (5.8.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + rack (1.6.4) + rack-test (0.6.3) rack (>= 1.0) - rails (3.1.0) - actionmailer (= 3.1.0) - actionpack (= 3.1.0) - activerecord (= 3.1.0) - activeresource (= 3.1.0) - activesupport (= 3.1.0) - bundler (~> 1.0) - railties (= 3.1.0) - railties (3.1.0) - actionpack (= 3.1.0) - activesupport (= 3.1.0) - rack-ssl (~> 1.3.2) + rails (4.2.4) + actionmailer (= 4.2.4) + actionpack (= 4.2.4) + actionview (= 4.2.4) + activejob (= 4.2.4) + activemodel (= 4.2.4) + activerecord (= 4.2.4) + activesupport (= 4.2.4) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.4) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.4) + actionpack (= 4.2.4) + activesupport (= 4.2.4) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.12) - json (~> 1.4) - sass (3.1.18) - sass-rails (3.1.6) - actionpack (~> 3.1.0) - railties (~> 3.1.0) - sass (>= 3.1.10) - tilt (~> 1.3.2) - sprockets (2.0.4) - hike (~> 1.2) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) + sass (3.4.18) + sass-rails (5.0.4) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + sprockets (3.3.4) rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.6) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - turn (0.9.5) + sprockets-rails (2.3.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) + thor (0.19.1) + thread_safe (0.3.5) + tilt (2.0.1) + turn (0.9.6) ansi - tzinfo (0.3.33) - uglifier (1.2.4) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (2.7.2) execjs (>= 0.3.0) - multi_json (>= 1.0.2) + json (>= 1.8.0) + web-console (2.0.0) + activemodel (~> 4.0) + binding_of_caller (>= 0.7.2) + railties (~> 4.0) + sprockets-rails (>= 2.0, < 4.0) PLATFORMS ruby DEPENDENCIES - coffee-rails (~> 3.1.0) + coffee-rails jquery-rails - rails (= 3.1.0) - sass-rails (~> 3.1.0) + jquery-ui-rails + plutus! + rails (>= 4.0) + sass-rails sqlite3 turn uglifier + web-console (~> 2.0) + +BUNDLED WITH + 1.10.4 diff --git a/fixture_rails_root/app/assets/javascripts/application.js b/fixture_rails_root/app/assets/javascripts/application.js index 37c7bfcd..968bd5d8 100644 --- a/fixture_rails_root/app/assets/javascripts/application.js +++ b/fixture_rails_root/app/assets/javascripts/application.js @@ -5,5 +5,6 @@ // the compiled file. // //= require jquery +//= require jquery.ui.all //= require jquery_ujs //= require_tree . diff --git a/fixture_rails_root/app/assets/stylesheets/application.css b/fixture_rails_root/app/assets/stylesheets/application.css index fc25b572..e32d91c9 100644 --- a/fixture_rails_root/app/assets/stylesheets/application.css +++ b/fixture_rails_root/app/assets/stylesheets/application.css @@ -2,6 +2,7 @@ * This is a manifest file that'll automatically include all the stylesheets available in this directory * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require jquery.ui.datepicker *= require_self *= require_tree . */ \ No newline at end of file diff --git a/fixture_rails_root/config/application.rb b/fixture_rails_root/config/application.rb index ffe61142..9dccb357 100644 --- a/fixture_rails_root/config/application.rb +++ b/fixture_rails_root/config/application.rb @@ -3,10 +3,7 @@ require 'rails/all' if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require *Rails.groups(:assets => %w(development test)) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) + Bundler.require(*Rails.groups) end module FixtureRailsRoot diff --git a/fixture_rails_root/config/environments/test.rb b/fixture_rails_root/config/environments/test.rb index 7526fa49..f09661ff 100644 --- a/fixture_rails_root/config/environments/test.rb +++ b/fixture_rails_root/config/environments/test.rb @@ -40,4 +40,7 @@ # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets config.assets.allow_debugging = true + + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' end diff --git a/fixture_rails_root/lib/tasks/utils.rake b/fixture_rails_root/lib/tasks/utils.rake new file mode 100644 index 00000000..edb699c1 --- /dev/null +++ b/fixture_rails_root/lib/tasks/utils.rake @@ -0,0 +1,73 @@ +namespace :dummy_data do + desc "Clear dummy data" + task :clear => :environment do + Plutus::Entry.destroy_all + Plutus::Asset.destroy_all + Plutus::Liability.destroy_all + Plutus::Revenue.destroy_all + Plutus::Expense.destroy_all + end + + desc "Generate dummy data for developing against" + task :generate => :environment do + # Create accounts + Plutus::Asset.find_or_create_by!(name: 'Checking Account') + Plutus::Asset.find_or_create_by!(name: 'Prepaid Fees') + Plutus::Asset.find_or_create_by!(name: 'Accounts Receivable') + + Plutus::Liability.find_or_create_by!(name: 'Customer Deposits Held') + Plutus::Liability.find_or_create_by!(name: 'State Tax Payable') + Plutus::Liability.find_or_create_by!(name: 'Accounts Payable') + + Plutus::Revenue.find_or_create_by!(name: 'Sales Income') + Plutus::Revenue.find_or_create_by!(name: 'Rental Income') + + Plutus::Expense.find_or_create_by!(name: 'Cleaning Fees') + Plutus::Expense.find_or_create_by!(name: 'Payment Processing Fees') + + def random_asset_account + Plutus::Asset.offset(rand(Plutus::Asset.count)).first.name + end + def random_liability_account + Plutus::Liability.offset(rand(Plutus::Liability.count)).first.name + end + def random_revenue_account + Plutus::Revenue.offset(rand(Plutus::Revenue.count)).first.name + end + def random_expense_account + Plutus::Expense.offset(rand(Plutus::Expense.count)).first.name + end + def random_currency_amount + (rand * 1000).round(2) + end + + # Create a bunch of dummy entries so that reports are populated. + 100.times do |t| + amount = random_currency_amount + Plutus::Entry.create!( + description: "Transfer record ##{t}", + debits: [{account: random_asset_account, amount: amount}], + credits: [{account: random_liability_account, amount: amount}], + date: Date.today - t.days + ) + + amount = random_currency_amount * 2 + Plutus::Entry.create!( + description: "Revenue record ##{t}", + debits: [{account: random_asset_account, amount: amount}], + credits: [{account: random_revenue_account, amount: amount}], + date: Date.today - t.days + ) + + amount = random_currency_amount + Plutus::Entry.create!( + description: "Expense record ##{t}", + debits: [{account: random_expense_account, amount: amount}], + credits: [{account: random_asset_account, amount: amount}], + date: Date.today - t.days + ) + end + end + + +end diff --git a/fixture_rails_root/vendor/assets/stylesheets/.gitkeep b/fixture_rails_root/vendor/assets/stylesheets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/fixture_rails_root/vendor/plugins/.gitkeep b/fixture_rails_root/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29b..00000000