Skip to content

Commit

Permalink
Merge pull request #49 from camsys/quarter1
Browse files Browse the repository at this point in the history
Quarter1
  • Loading branch information
mathmerized authored Apr 20, 2018
2 parents 68f5baa + 8919a95 commit 72d588e
Show file tree
Hide file tree
Showing 45 changed files with 2,944 additions and 1,372 deletions.
Empty file added .hooks/applypatch-msg
Empty file.
Empty file added .hooks/commit-msg
Empty file.
Empty file added .hooks/post-applypatch
Empty file.
28 changes: 28 additions & 0 deletions .hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# If checking out a branch that follows the pattern "quarter#", get its name
branch=$(git reflog | awk 'NR==1{print $8; exit}' | grep 'quarter\d')

# If a quarter# branch was checked out...
if [ $branch ] ; then
# Add a colon (:) before the branch name for proper searching
branch=":${branch}"

# Get the outdatedBranches (for logging purposes later) if there are any
outdatedGems=$(grep -nr ':quarter\d' Gemfile)
outdatedBranches=()
while read -r oldBranch ; do
if [ "$branch" != "$oldBranch" ] ; then
outdatedBranches+=("$oldBranch")
fi
done < <(grep -o ':quarter\d' <<< "${outdatedGems}")

# Replace all branches in the file with the new branch
if [ "${outdatedBranches}" ] ; then
echo -e "Your Gemfile contains the following gems which do not match your current branch:\n**********\n${outdatedGems}\n**********"

sed -i '' "s/:quarter[0-9]/${branch}/g" "./Gemfile"

echo "They have been updated to ${branch}."
fi
fi
Empty file added .hooks/post-commit
Empty file.
Empty file added .hooks/post-merge
Empty file.
Empty file added .hooks/post-receive
Empty file.
Empty file added .hooks/post-rewrite
Empty file.
Empty file added .hooks/post-update
Empty file.
Empty file added .hooks/pre-applypatch
Empty file.
Empty file added .hooks/pre-auto-gc
Empty file.
Empty file added .hooks/pre-commit
Empty file.
Empty file added .hooks/pre-push
Empty file.
Empty file added .hooks/pre-rebase
Empty file.
Empty file added .hooks/pre-receive
Empty file.
Empty file added .hooks/prepare-commit-msg
Empty file.
Empty file added .hooks/update
Empty file.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ rvm:
- 2.2.2
branches:
only:
- master
- master
- /quarter\d*/
env:
- TEST_SUITE=rspec RAILS_VERSION=4.1.9
script:
Expand All @@ -14,3 +15,4 @@ before_script:
- cp spec/dummy/config/database.travis.yml spec/dummy/config/database.yml
before_install:
- mysql -e "create database IF NOT EXISTS transam_accounting_testing;" -uroot
bundler_args: --without not_travis
17 changes: 14 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ source "https://rubygems.org"

# To use debugger
# gem 'debugger'
gem 'transam_core', :github => 'camsys/transam_core', branch: 'master'
gem 'transam_reporting', :github => 'camsys/transam_reporting', branch: 'master'
gem 'transam_transit', :github => 'camsys/transam_transit', branch: 'master'
gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter1
gem 'transam_reporting', git: 'https://github.com/camsys/transam_reporting', branch: :quarter1
gem 'transam_transit', git: 'https://github.com/camsys/transam_transit', branch: :quarter1
gem 'mysql2', '~> 0.3.20' # lock gem for dummy app
gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath

# This gem allows us to share githooks. Githooks in the .hooks folder can be checked
# in, and when "bundle install" is run this gem automatically creates symlinks into
# your local .git/hooks. If you have pre-existing hooks in .git/hooks, it will move
# them to .git/hooks/old and you can move them back at your leisure. Any hooks
# checked in to .hooks will be shared among the team. If you need to re-generate
# the symlinks,you can use 'bundle exec git-hookshot'
# add group not to run on travis because git-hookshot gem seems to have issues on travis
group :not_travis do
gem "git-hookshot", git: 'https://github.com/brandonweiss/git-hookshot', branch: :master
end

# Declare your gem's dependencies in transam_accounting.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
Expand Down
12 changes: 12 additions & 0 deletions app/models/chart_of_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ChartOfAccount < ActiveRecord::Base
#------------------------------------------------------------------------------
after_initialize :set_defaults

after_create :activate_gl_reports

#------------------------------------------------------------------------------
# Associations
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -84,5 +86,15 @@ def set_defaults
self.active = self.active.nil? ? true : self.active
end

# GL reports are deactivated in new transam instance
# if a chart of account exists, GL features are enabled -- therefore need to activate reports
def activate_gl_reports
report_type = ReportType.find_by(name: "GL/Accounting Report")
report_type.update!(active: true)

report_type.reports.update_all(active: true)

end


end
8 changes: 4 additions & 4 deletions app/views/assets/_accounting_detail_tabs.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%a{:href => "#depreciation", :data =>{:toggle => 'tab'}}
Asset Values

%li
%a{:href => "#expenditures", :data =>{:toggle => 'tab'}}
%span.badge.pull-right= @asset.expenditures.count
CapEx
-#%li
-# %a{:href => "#expenditures", :data =>{:toggle => 'tab'}}
-# %span.badge.pull-right= @asset.expenditures.count
-# CapEx
6 changes: 3 additions & 3 deletions app/views/assets/_accounting_detail_tabs_content.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
.tab-content
= render 'depreciation_table'

.tab-pane.fade#expenditures
.tab-content
= render :partial => 'expenditures/index_table', :locals => {:expenditures => @asset.expenditures}
-#.tab-pane.fade#expenditures
-# .tab-content
-# = render :partial => 'expenditures/index_table', :locals => {:expenditures => @asset.expenditures}
2 changes: 1 addition & 1 deletion app/views/assets/_depreciation_table.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.col-xs-4 = format_field("Purchase Date", format_as_date(@asset.purchase_date) ) = format_field("In Service Date", format_as_date(@asset.in_service_date) ) = format_field("Depreciation Start Date", format_as_date(@asset.depreciation_start_date) ) = format_field("Current Depreciation Date", format_as_date(@asset.current_depreciation_date) ).col-xs-4 = format_field("Original Useful Life", "#{format_as_integer(@asset.original_depreciation_useful_life_months)} months" ) = format_field("Adjusted Useful Life", "#{format_as_integer(@asset.adjusted_depreciation_useful_life_months)} months" ) = format_field("Original Cost Basis", format_as_currency(@asset.original_cost_basis) ) = format_field("Adjusted Cost Basis", format_as_currency(@asset.adjusted_cost_basis) ).col-xs-4 = format_field("Salvage Value", format_as_currency(@asset.salvage_value) ) = format_field("Policy Replacement Cost", format_as_currency(@asset.estimated_replacement_cost) )#depreciation_table_actions.btn-group - if can? :update, @asset = link_to new_inventory_asset_event_path(@asset, :event_type => BookValueUpdateEvent.asset_event_type.id), :class => 'btn btn-default' do %i.fa.fa-fw{:class => BookValueUpdateEvent.asset_event_type.display_icon_name} = 'Adjust Book Value' - if can? :create, Expenditure = link_to new_inventory_expenditure_path(@asset), :class => 'btn btn-default' do %i.fa.fa-plus.fa-fw = " Add CapEx".col-xs-12 %fieldset %table.table.table-hover#depreciation_table{:data => {:toggle => 'table', :pagination => 'true', :show_pagination_switch => 'true', :page_list => "[5, 10, 20, 50, 100, 200]", :page_size => current_user.num_table_rows, :search => 'false', :toolbar => "#depreciation_table_actions", :export_types => "['csv', 'txt', 'excel']", :show_export => 'true', :show_toggle => 'false', :state_save => 'true', :state_save_id_table => "asset_depreciation_id", :state_save_expire => "1y"}} %thead %tr %th.left Date %th.left Description - if ChartOfAccount.find_by(organization_id: @asset.organization_id) %th.left GL Account %th.right Amount %th.right Net Book Value %tbody - @asset.get_depreciation_table.each do |row| %tr %td.left= format_as_date(row[:on_date]) %td.left= row[:description] - if ChartOfAccount.find_by(organization_id: @asset.organization_id) %td.left= link_to row[:general_ledger_account].account_number, general_ledger_account_path(row[:general_ledger_account]) unless row[:general_ledger_account].blank? %td.right= format_as_currency(row[:amount].to_i) %td.right= format_as_currency(row[:book_value].to_i):javascript $("#depreciation_table").on('all.bs.table', function(evt, name, args) { $('.fixed-table-container').css('min-height', '300px') transam.make_same_height('.header-part'); }); $(window).load(function() { transam.make_same_height('.header-part'); }); $(window).resize(function() { $("#depreciation_table").bootstrapTable('resetView'); });
.col-xs-4 = format_field("Purchase Date", format_as_date(@asset.purchase_date) ) = format_field("In Service Date", format_as_date(@asset.in_service_date) ) = format_field("Depreciation Start Date", format_as_date(@asset.depreciation_start_date) ) = format_field("Current Depreciation Date", format_as_date(@asset.current_depreciation_date) ).col-xs-4 = format_field("Original Useful Life", "#{format_as_integer(@asset.original_depreciation_useful_life_months)} months" ) = format_field("Adjusted Useful Life", "#{format_as_integer(@asset.adjusted_depreciation_useful_life_months)} months" ) = format_field("Original Cost Basis", format_as_currency(@asset.original_cost_basis) ) = format_field("Adjusted Cost Basis", format_as_currency(@asset.adjusted_cost_basis) ).col-xs-4 = format_field("Salvage Value", format_as_currency(@asset.salvage_value) ) = format_field("Policy Replacement Cost", format_as_currency(@asset.estimated_replacement_cost) )#depreciation_table_actions.btn-group -#- if can? :update, @asset -# = link_to new_inventory_asset_event_path(@asset, :event_type => BookValueUpdateEvent.asset_event_type.id), :class => 'btn btn-default' do -# %i.fa.fa-fw{:class => BookValueUpdateEvent.asset_event_type.display_icon_name} -# = 'Adjust Book Value' -# -# - if can? :create, Expenditure -# = link_to new_inventory_expenditure_path(@asset), :class => 'btn btn-default' do -# %i.fa.fa-plus.fa-fw -# = " Add CapEx".col-xs-12 %fieldset %table.table.table-hover#depreciation_table{:data => {:toggle => 'table', :pagination => 'true', :show_pagination_switch => 'true', :page_list => "[5, 10, 20, 50, 100, 200]", :page_size => current_user.num_table_rows, :search => 'false', :toolbar => "#depreciation_table_actions", :export_types => "['csv', 'txt', 'excel']", :show_export => 'true', :show_toggle => 'false', :state_save => 'true', :state_save_id_table => "asset_depreciation_id", :state_save_expire => "1y"}} %thead %tr %th.left Date %th.left Description - if ChartOfAccount.find_by(organization_id: @asset.organization_id) %th.left GL Account %th.right Amount %th.right Net Book Value %tbody - @asset.get_depreciation_table.each do |row| %tr %td.left= format_as_date(row[:on_date]) %td.left= row[:description] - if ChartOfAccount.find_by(organization_id: @asset.organization_id) %td.left= link_to row[:general_ledger_account].account_number, general_ledger_account_path(row[:general_ledger_account]) unless row[:general_ledger_account].blank? %td.right= format_as_currency(row[:amount].to_i) %td.right= format_as_currency(row[:book_value].to_i):javascript $("#depreciation_table").on('all.bs.table', function(evt, name, args) { $('.fixed-table-container').css('min-height', '300px') transam.make_same_height('.header-part'); }); $(window).load(function() { transam.make_same_height('.header-part'); }); $(window).resize(function() { $("#depreciation_table").bootstrapTable('resetView'); });
Expand Down
70 changes: 0 additions & 70 deletions app/views/shared/_accounting_financial_nav.html.haml

This file was deleted.

85 changes: 69 additions & 16 deletions app/views/shared/_financial_nav.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,76 @@
%ul.dropdown-menu.multi-level{:role => 'menu'}

- count = 0
- if ChartOfAccount.where(organization_id: @organization_list).count > 0
- count += 1
- if @organization_list.count == 1
%li.text-left
= link_to general_ledger_accounts_path do
%i.fa.fa-book.fa-fw
Chart of Accounts
- else
%li.text-left.dropdown-submenu
= link_to '#' do
%i.fa.fa-book.fa-fw
Chart of Accounts

%ul.dropdown-menu
- Organization.where(id: @organization_list).each do |org|
%li.text-left
= link_to general_ledger_accounts_path(:organization_id => org.id) do
%i.fa.fa-fw.fa-book
= org.short_name

- if SearchType.find_by(class_name: 'GeneralLedgerAccountSearcher')
- if count > 0
%li.divider
- count += 1
%li.text-left
= link_to reset_searches_path(:search_type => SearchType.find_by(class_name: 'GeneralLedgerAccountSearcher').id) do
%i.fa.fa-search.fa-fw
GL Query

-#%li.divider
-#%li.text-left
-# = link_to grants_path do
-# %i.fa.fa-fw.fa-legal
-# = ' Grants'
-#
-#%li.divider
-#%li.text-left
-# = link_to vendors_path do
-# %i.fa.fa-fw.fa-tag
-# = ' Vendors'

- if count > 0
%li.divider
%li.text-left.dropdown-submenu
= link_to funding_sources_path do
%i.fa.fa-book.fa-fw
Programs

%ul.dropdown-menu
- FundingSourceType.all.each do |type|
- if FundingSource.where(funding_source_type_id: type.id).count > 0
%li.text-left.dropdown-submenu
= link_to '#' do
%i.fa.fa-fw.fa-book
= type
%ul.dropdown-menu
- FundingSource.where(funding_source_type_id: type.id).each do | program |
%li.text-left
= link_to funding_source_path(program) do
%i.fa.fa-fw.fa-book
= program
- if can? :create, FundingSource
%li.divider
%li
= link_to new_funding_source_path do
%i.fa.fa-plus.fa-fw
= "Add Funding Program";

- SystemConfig.transam_module_names.each do |mod|
- view_component = "#{mod}_financial_nav"
- if lookup_context.template_exists?(view_component, 'shared', true)
- count += 1
- if count > 1
%li.divider
= render :partial => "shared/#{view_component}"

%li.divider
%li.text-left
- if can? :read_all, CapitalPlan
= link_to capital_plans_path do
%i.fa.fa-fw.fa-list
Status
- else
- org_list = @organization_list.select{|x| Asset.operational.where(organization_id: x).count > 0}
- if org_list.count > 0
= link_to capital_plan_path(CapitalPlan.current_plan(org_list.first)) do
%i.fa.fa-fw.fa-list
Status
= render :partial => "shared/#{view_component}", :locals => {:count => count}
Loading

0 comments on commit 72d588e

Please sign in to comment.