has_accounts_engine 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +24 -0
  3. data/app/controllers/accounts_controller.rb +52 -0
  4. data/app/controllers/bank_accounts_controller.rb +3 -0
  5. data/app/controllers/banks_controller.rb +3 -0
  6. data/app/controllers/bookings_controller.rb +67 -0
  7. data/app/helpers/account_helper.rb +6 -0
  8. data/app/views/accounts/_account.html.haml +12 -0
  9. data/app/views/accounts/_booking_item.html.haml +15 -0
  10. data/app/views/accounts/_booking_list_footer.html.haml +2 -0
  11. data/app/views/accounts/_booking_list_header.html.haml +8 -0
  12. data/app/views/accounts/_booking_list_paginate.html.haml +5 -0
  13. data/app/views/accounts/_booking_list_saldo.html.haml +8 -0
  14. data/app/views/accounts/_booking_list_turnover.html.haml +8 -0
  15. data/app/views/accounts/_carry_booking.html.haml +9 -0
  16. data/app/views/accounts/_edit_booking.html.haml +14 -0
  17. data/app/views/accounts/_edit_bookings.html.haml +15 -0
  18. data/app/views/accounts/_form.html.haml +7 -0
  19. data/app/views/accounts/_list_footer.html.haml +2 -0
  20. data/app/views/accounts/_list_header.html.haml +5 -0
  21. data/app/views/accounts/_show.html.haml +9 -0
  22. data/app/views/accounts/_show_bookings.html.haml +19 -0
  23. data/app/views/accounts/edit_bookings.html.haml +5 -0
  24. data/app/views/accounts/edit_bookings.js.erb +2 -0
  25. data/app/views/accounts/index.html.haml +9 -0
  26. data/app/views/accounts/show.html.haml +10 -0
  27. data/app/views/bank_accounts/_bank_account.html.haml +1 -0
  28. data/app/views/bank_accounts/_form.html.haml +10 -0
  29. data/app/views/banks/_bank.html.haml +3 -0
  30. data/app/views/banks/_form.html.haml +12 -0
  31. data/app/views/bookings/_booking.html.haml +17 -0
  32. data/app/views/bookings/_form.html.haml +28 -0
  33. data/app/views/bookings/_list.html.haml +16 -0
  34. data/app/views/bookings/_new_form.html.haml +5 -0
  35. data/app/views/bookings/_sidebar.html.haml +6 -0
  36. data/app/views/bookings/_simple_form.html.haml +25 -0
  37. data/app/views/bookings/new.html.haml +8 -0
  38. data/app/views/bookings/select.html.haml +11 -0
  39. data/app/views/bookings/show.html.haml +7 -0
  40. data/app/views/bookings/simple_edit.html.haml +4 -0
  41. data/config/locales/de.yml +83 -0
  42. data/config/locales/en.yml +65 -0
  43. data/config/routes.rb +44 -0
  44. data/lib/has_accounts_engine.rb +1 -0
  45. data/lib/has_accounts_engine/railtie.rb +8 -0
  46. data/lib/has_accounts_engine/version.rb +3 -0
  47. metadata +192 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ has_accounts_engine
2
+ ===================
3
+
4
+ [![Build Status](https://secure.travis-ci.org/huerlisi/has_accounts_engine.png)](http://travis-ci.org/huerlisi/has_accounts_engine)
5
+
6
+ HasAccountsEngine is a full featured Rails 3 gem accompinying has_accounts with controllers, views...
7
+
8
+
9
+ Install
10
+ =======
11
+
12
+ In Rails 3 simply add
13
+
14
+ gem 'has_accounts_engine'
15
+
16
+ License
17
+ =======
18
+
19
+ * Copyright (c) 2008 Agrabah <http://www.agrabah.ch>
20
+ * Copyright (c) 2008-2013 Simon Hürlimann <simon.huerlimann@cyt.ch>
21
+ * Copyright (c) 2010-2013 CyT <http://www.cyt.ch>
22
+ * Copyright (c) 2008-2010 ZytoLabor <http://www.zyto-labor.com>
23
+
24
+ Released under the MIT license.
@@ -0,0 +1,52 @@
1
+ class AccountsController < AuthorizedController
2
+ # Scopes
3
+ has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
4
+ has_scope :by_text
5
+
6
+ has_scope :page, :only => :index
7
+
8
+ def index
9
+ @accounts = apply_scopes(Account).includes(:account_type).includes(:credit_bookings, :credit_bookings)
10
+ end
11
+
12
+ def show
13
+ @account = Account.find(params[:id])
14
+ @bookings = apply_scopes(Booking).includes(:debit_account => :account_type, :credit_account => :account_type).by_account(@account)
15
+ @bookings = @bookings.page(params[:page]) || 1
16
+
17
+ if params[:only_credit_bookings]
18
+ @bookings = @bookings.where(:credit_account_id => @account.id)
19
+ end
20
+ if params[:only_debit_bookings]
21
+ @bookings = @bookings.where(:debit_account_id => @account.id)
22
+ end
23
+ @bookings = @bookings
24
+ @carry_booking = @bookings.all.first
25
+
26
+ show!
27
+ end
28
+
29
+ def csv_bookings
30
+ @account = Account.find(params[:id])
31
+ @bookings = apply_scopes(Booking).by_account(@account)
32
+ send_csv @bookings, :only => [:value_date, :title, :comments, :amount, 'credit_account.code', 'debit_account.code'], :filename => "%s-%s.csv" % [@account.code, @account.title]
33
+ end
34
+
35
+ def edit_bookings
36
+ @account = Account.find(params[:id])
37
+ @bookings = apply_scopes(Booking).by_account(@account)
38
+ end
39
+
40
+ def update_bookings
41
+ bookings = params[:bookings]
42
+
43
+ bookings.each do |id, attributes|
44
+ attributes.merge!({:credit_account_id => Account.find_by_code(attributes[:credit_account_code]).id})
45
+ attributes.merge!({:debit_account_id => Account.find_by_code(attributes[:debit_account_code]).id})
46
+ Booking.find(id).update_attributes(attributes)
47
+ end
48
+
49
+ account = Account.find(params[:id])
50
+ redirect_to account
51
+ end
52
+ end
@@ -0,0 +1,3 @@
1
+ class BankAccountsController < AccountsController
2
+ defaults :resource_class => BankAccount
3
+ end
@@ -0,0 +1,3 @@
1
+ class BanksController < PeopleController
2
+ defaults :resource_class => Bank
3
+ end
@@ -0,0 +1,67 @@
1
+ class BookingsController < AuthorizedController
2
+ # Scopes
3
+ has_scope :by_value_period, :using => [:from, :to], :default => proc { |c| c.session[:has_scope] }
4
+ has_scope :by_text
5
+
6
+ # Actions
7
+ def index
8
+ # @bookings = apply_scopes(Booking).accessible_by(current_ability, :list).includes(:credit_account, :debit_account).paginate(:page => params[:page], :per_page => params[:per_page])
9
+ index!
10
+ end
11
+
12
+ def new
13
+ @booking = Booking.new(:value_date => Date.today)
14
+ # Only include base class records
15
+ @booking_templates = BookingTemplate.where(:type => [nil, 'BookingTemplate']).where("NOT(code LIKE '%:%')").paginate(:page => params[:page])
16
+ new!
17
+ end
18
+
19
+ def select_booking
20
+ @booking = Booking.find(params[:id]).dup
21
+
22
+ # Clear reference
23
+ @booking.reference = nil
24
+
25
+ increment_booking_code
26
+ # Take value date from form
27
+ @booking.value_date = params[:booking][:value_date]
28
+
29
+ render :action => 'simple_edit'
30
+ end
31
+
32
+ def simple_edit
33
+ new!
34
+ end
35
+
36
+ def select
37
+ @booking = Booking.new(params[:booking])
38
+ increment_booking_code
39
+ @booking_templates = BookingTemplate.where(:type => [nil, 'BookingTemplate']).where("NOT(code LIKE '%:%')").paginate(:page => params[:page])
40
+ @bookings = Booking.where("title LIKE ?", '%' + @booking.title + '%').order('value_date DESC').paginate(:page => params[:page])
41
+ end
42
+
43
+ def create
44
+ @booking = Booking.new(params[:booking])
45
+
46
+ create! do |success, failure|
47
+ success.html do
48
+ redirect_to new_booking_path
49
+ end
50
+ failure.html {render 'edit'}
51
+ end
52
+ end
53
+
54
+ def copy
55
+ original_booking = Booking.find(params[:id])
56
+
57
+ @booking = original_booking.dup
58
+
59
+ render 'edit'
60
+ end
61
+
62
+ private
63
+
64
+ def increment_booking_code
65
+ @booking.code = (Booking.maximum(:code) || 0) + 1
66
+ end
67
+ end
@@ -0,0 +1,6 @@
1
+ module AccountHelper
2
+ def accounts_as_collection(accounts = nil)
3
+ accounts ||= Account.all
4
+ accounts.collect{|account| ["%s - %s" % [account.code, account.title], account.id]}
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ %tr[account]
2
+ %td= account.code
3
+ %td= link_to account.title, url_for(account), {'data-href-container' => 'tr'}, :by_value_period => params[:by_value_period]
4
+ - if @date
5
+ %td{:style => "text-align: right"}= currency_fmt(account.saldo(@date))
6
+ - elsif params[:by_value_period]
7
+ %td{:style => "text-align: right"}= currency_fmt(account.saldo(params[:by_value_period][:from]..params[:by_value_period][:to]))
8
+ - else
9
+ %td{:style => "text-align: right"}= currency_fmt(account.saldo)
10
+ %td.action-links
11
+ = list_link_for(:edit, account)
12
+ = list_link_for(:delete, account)
@@ -0,0 +1,15 @@
1
+ %tr[@booking]
2
+ %td= @booking.value_date
3
+ %td
4
+ = link_to @booking.title, @booking, {'data-href-container' => 'tr'}
5
+ - if @booking.comments.present?
6
+ %hr{:style => "height: 1px; margin: 0"}/
7
+ %i= @booking.comments
8
+ %td= link_to @booking.reference.to_s(:reference), @booking.reference unless @booking.reference.nil?
9
+ %td.currency= (@booking.credit_account == @account) ? currency_fmt(@booking.amount) : content_tag('i', link_to(@booking.credit_account.code, account_path(@booking.credit_account), :title => @booking.credit_account.title))
10
+ %td.currency= (@booking.debit_account == @account) ? currency_fmt(@booking.amount) : content_tag('i', link_to(@booking.debit_account.code, account_path(@booking.debit_account), :title => @booking.debit_account.title))
11
+ %td.currency= currency_fmt(@saldo)
12
+ %td.action-links
13
+ = list_link_for(:edit, [@account, @booking])
14
+ = list_link_for(:delete, [@account, @booking], :remote => true)
15
+ = list_link_for(:copy, @booking)
@@ -0,0 +1,2 @@
1
+ = render 'accounts/booking_list_turnover'
2
+ = render 'accounts/booking_list_saldo'
@@ -0,0 +1,8 @@
1
+ %tr
2
+ %th= t_attr :date, Booking
3
+ %th= t_attr :text, Booking
4
+ %th= t_attr :reference, Booking
5
+ %th.currency= t_attr :credit_account, Booking
6
+ %th.currency= t_attr :debit_account, Booking
7
+ %th.currency= t_attr :balance, Booking
8
+ %th.action-links.count-3
@@ -0,0 +1,5 @@
1
+ %tr
2
+ - ## TODO: See http://groups.google.com/group/will_paginate/browse_thread/thread/5d702999d78e47e5
3
+ - url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
4
+ %th{:colspan => "6", :style => "text-align: right"}= will_paginate @bookings, :params => url_params.merge(:query => params[:query])
5
+ %th
@@ -0,0 +1,8 @@
1
+ %tr#booking_list_saldo{:style => "border-top: double 2px black"}
2
+ %td{:colspan => "2"}
3
+ Kontostand (per #{@bookings.last.value_date})
4
+ %td
5
+ %td
6
+ %td
7
+ %td{:style => "text-align: right"}= currency_fmt(@account.saldo(@bookings.last))
8
+ %td
@@ -0,0 +1,8 @@
1
+ - credit_turnover, debit_turnover = @account.turnover(@bookings)
2
+ %tr#booking_list_turnover{:style => "border-top: double 2px black"}
3
+ %td{:colspan => "3"}
4
+ Umsatz (#{h @bookings.first.value_date} bis #{h @bookings.last.value_date})
5
+ %td{:style => "text-align: right"}= currency_fmt(credit_turnover)
6
+ %td{:style => "text-align: right"}= currency_fmt(debit_turnover)
7
+ %td
8
+ %td
@@ -0,0 +1,9 @@
1
+ %tr{:id => "carry_booking"}
2
+ %td= @carry_booking.value_date
3
+ %td
4
+ = t('bookyt.carry_booking')
5
+ %td
6
+ %td
7
+ %td
8
+ %td{:style => "text-align: right"}= currency_fmt(@saldo)
9
+ %td.action-links
@@ -0,0 +1,14 @@
1
+ %tr
2
+ = f.fields_for "", edit_booking do |f|
3
+ %td.span2= f.text_field :value_date, :style => 'width: 96%'
4
+ %td.span6
5
+ = f.text_field :title, :style => 'width: 98%'
6
+ = f.text_field :comments, :style => 'width: 98%'
7
+ = f.hidden_field :reference_type, :value => 'Invoice'
8
+ = f.select :reference_id, suggested_invoices_for_booking(f.object), :include_blank => true, :style => 'width: 98%', :class => 'combobox'
9
+ %td.span1= f.text_field :amount, :style => 'width: 94%'
10
+
11
+ %td.span1= f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :style => 'width: 94%', :wrapper => :inline
12
+ %td.span1= f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox, :style => 'width: 94%', :wrapper => :inline
13
+
14
+ %td{:style => 'display:none'}= f.hidden_field :id
@@ -0,0 +1,15 @@
1
+ - url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
2
+ = paginated_section @bookings, :params => url_params.merge(:query => params[:query]) do
3
+ = simple_form_for :bookings, :url => update_bookings_account_path do |f|
4
+ %table.table.table-striped
5
+ %thead
6
+ %tr
7
+ %th= t_attr :value_date, Booking
8
+ %th= t_attr :title, Booking
9
+ %th= t_attr :amount, Booking
10
+ %th= t_attr :credit_account, Booking
11
+ %th= t_attr :debit_account, Booking
12
+ %tbody
13
+ = render :partial => 'edit_booking', :collection => @bookings, :locals => {:f => f}
14
+
15
+ = f.button :submit
@@ -0,0 +1,7 @@
1
+ = simple_form_for @account do |f|
2
+ = f.input :code
3
+ = f.input :title
4
+ = f.association :account_type, :label_method => :title
5
+
6
+ .form-actions
7
+ = f.button :submit
@@ -0,0 +1,2 @@
1
+ %tr
2
+ %th{:colspan => "4", :style => "text-align: right"}= will_paginate @accounts, :params => {:query => params[:query]}
@@ -0,0 +1,5 @@
1
+ %tr
2
+ %th= t_attr(:code, Account)
3
+ %th= t_attr(:title, Account)
4
+ %th{:style => "text-align: right"}= t_attr(:saldo, Account)
5
+ %th.action-links
@@ -0,0 +1,9 @@
1
+ .tabbable
2
+ %ul.nav.nav-tabs
3
+ %li.active= link_to t_title(:journal, Account), '#tab-bookings', {:data => {:toggle => 'tab'}}
4
+ %li= link_to t_title(:info, Account), '#tab-info', {:data => {:toggle => 'tab'}}
5
+ %li= link_to t_title(:list, Attachment), '#tab-attachments', {:data => {:toggle => 'tab'}}
6
+
7
+ .tab-content
8
+ #tab-bookings.tab-pane.active= render 'show_bookings'
9
+ #tab-info.tab-pane= render "form"
@@ -0,0 +1,19 @@
1
+ - url_params = {:controller => 'accounts', :action => 'show', :id => params[:account_id] || params[:id]}
2
+
3
+ %table.table.table-striped.bookings.collection
4
+ %thead
5
+ = render 'accounts/booking_list_header'
6
+ - @saldo = @account.saldo(@carry_booking, false)
7
+ %tbody
8
+ = render 'accounts/carry_booking' unless @saldo == 0
9
+
10
+ - for @booking in @bookings
11
+ - amount = @booking.amount
12
+ - amount = -(amount) if @account.is_liability_account?
13
+ - @saldo -= amount if @booking.debit_account == @account
14
+ - @saldo += amount if @booking.credit_account == @account
15
+ = render 'accounts/booking_item'
16
+ %tfoot
17
+ = render 'accounts/booking_list_footer' unless @bookings.empty?
18
+ = paginate @bookings
19
+
@@ -0,0 +1,5 @@
1
+ = contextual_links
2
+
3
+ = boot_page_title
4
+
5
+ = render 'edit_bookings'
@@ -0,0 +1,2 @@
1
+ $('#edit_bookings').replaceWith('<%=escape_javascript render "edit_bookings" %>');
2
+ $('#edit-bookings').addClass('active');
@@ -0,0 +1,9 @@
1
+ = contextual_links
2
+ = boot_page_title
3
+ %table.table.table-striped.accounts.collection
4
+ %thead
5
+ = render 'list_header'
6
+ %tbody
7
+ = render @accounts
8
+
9
+ = render 'bookings/sidebar'
@@ -0,0 +1,10 @@
1
+ .contextual
2
+ = icon_link_to 'only_credit_bookings', url_for(:only_credit_bookings => true) unless params[:only_credit_bookings]
3
+ = icon_link_to 'only_debit_bookings', url_for(:only_debit_bookings => true) unless params[:only_debit_bookings]
4
+ = icon_link_to 'all_bookings', @account if params[:only_credit_bookings] || params[:only_debit_bookings]
5
+ = contextual_links_for
6
+
7
+ = boot_page_title
8
+ = render 'show'
9
+
10
+ = render 'bookings/sidebar'
@@ -0,0 +1 @@
1
+ = render 'accounts/account', :account => bank_account
@@ -0,0 +1,10 @@
1
+ = simple_form_for @bank_account do |f|
2
+ = f.input :code
3
+ = f.input :pc_id
4
+ = f.input :esr_id
5
+ = f.input :title
6
+ = f.association :account_type, :label_method => :title
7
+ = f.association :bank, :as => :combobox
8
+
9
+ .form-actions
10
+ = f.button :submit
@@ -0,0 +1,3 @@
1
+ %tr[bank]
2
+ %td= link_to bank.vcard.try(:full_name), bank, {'data-href-container' => 'tr'}
3
+ %td= [ bank.vcard.address_lines.join(", "), bank.vcard.contacts.map{|contact| contact.to_s(': ', :label)}.join(', ') ].compact.join("<br/>").html_safe
@@ -0,0 +1,12 @@
1
+ = simple_form_for resource do |f|
2
+ = render 'address_form', :f => f
3
+
4
+ %h3= t('form.bank.money_transfer')
5
+ .row-fluid
6
+ .span6
7
+ = f.input :swift
8
+ .span6
9
+ = f.input :clearing
10
+
11
+ .form-actions
12
+ = f.button :submit
@@ -0,0 +1,17 @@
1
+ - item_action ||= lambda{|object| url_for(object)}
2
+
3
+ %tr[booking]
4
+ %td= booking.value_date
5
+ %td
6
+ = link_to booking.title, item_action.call(booking), 'data-href-container' => 'tr'
7
+ - if booking.comments.present?
8
+ %hr{:style => "height: 1px; margin: 0"}/
9
+ %i= booking.comments
10
+ %td= link_to booking.reference.to_s(:reference), booking.reference unless booking.reference.nil?
11
+ %td= link_to booking.credit_account.code, account_path(booking.credit_account), :title => booking.credit_account.title unless booking.credit_account.nil?
12
+ %td= link_to booking.debit_account.code, account_path(booking.debit_account), :title => booking.debit_account.title unless booking.debit_account.nil?
13
+ %td.currency= currency_fmt(booking.amount)
14
+ %td.action-links
15
+ = list_link_for(:edit, booking)
16
+ = list_link_for(:delete, booking, :remote => true)
17
+ = list_link_for(:copy, booking)
@@ -0,0 +1,28 @@
1
+ = simple_form_for @booking do |f|
2
+ .row-fluid
3
+ .span6
4
+ = f.input :title, :input_html => {"data-autofocus" => true}
5
+ .span6
6
+ = f.input :value_date, :as => :date_field
7
+ .row-fluid
8
+ .span6
9
+ = f.input :amount, :as => :string, :input_html => {:size => 12}
10
+ .span6
11
+ = f.input :code
12
+
13
+ .row-fluid
14
+ .span6
15
+ = f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
16
+ .span6
17
+ = f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
18
+
19
+ .row-fluid
20
+ .span12
21
+ = f.input :comments, :input_html => {:rows => 4, :class => 'span12'}
22
+
23
+ .row-fluid
24
+ .span12
25
+ = f.input :reference_type, :as => :hidden, :input_html => {:value => 'Invoice'}
26
+ //= f.association :reference, :collection => suggested_invoices_for_booking(@booking, :include_all => true), :as => :combobox, :include_blank => true
27
+
28
+ = f.button :submit
@@ -0,0 +1,16 @@
1
+ %table.table.table-striped.bookings.collection
2
+ %thead
3
+ %tr
4
+ %th= t_attr :valuta
5
+ %th= t_attr :title
6
+ %th= t_attr :reference
7
+ %th= t_attr :credit_account
8
+ %th= t_attr :debit_account
9
+ %th.currency= t_attr 'amount'
10
+ %th.action-links
11
+ %tbody
12
+ = render collection, :item_action => (item_action ||= nil)
13
+
14
+ = paginate collection
15
+
16
+ = render 'bookings/sidebar'
@@ -0,0 +1,5 @@
1
+ = simple_form_for @booking, :url => select_bookings_path do |f|
2
+ = hidden_field_tag :stage, 'select'
3
+ = f.input :title, :input_html => {'data-autofocus' => true}
4
+ = f.input :value_date, :as => :date_field, :input_html => {:size => 10, :style => 'text-align: right'}
5
+ = f.button :submit
@@ -0,0 +1,6 @@
1
+ - filter_name = :by_value_period
2
+ - content_for :sidebar do
3
+ - filters = current_tenant.fiscal_years.reverse.map do |period|
4
+ - value = {"from" => period[:from].to_s(:db), "to" => period[:to].to_s(:db)}
5
+ - {:value => value, :title => period[:to].year}
6
+ = boot_nav_filter(filter_name, [{:title => :all, :value => nil}] + filters)
@@ -0,0 +1,25 @@
1
+ = simple_form_for @booking do |f|
2
+
3
+ .row-fluid
4
+ .span6
5
+ = f.input :title, :input_html => {"data-autofocus" => true}
6
+ .span6
7
+ = f.input :value_date, :as => :date_field
8
+ .row-fluid
9
+ .span6
10
+ = f.input :amount, :as => :string, :input_html => {:size => 12}
11
+ .span6
12
+ = f.input :code
13
+
14
+ .row-fluid
15
+ .span6
16
+ = f.association :credit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
17
+ .span6
18
+ = f.association :debit_account, :collection => accounts_as_collection(Account.all), :as => :combobox
19
+
20
+ .row-fluid
21
+ .span12
22
+ = f.input :comments, :input_html => {:rows => 4}
23
+
24
+ = f.button :submit
25
+
@@ -0,0 +1,8 @@
1
+ = contextual_links
2
+
3
+ = boot_page_title(BookingTemplate)
4
+ = render 'booking_templates/list', :item_action => lambda{|object| new_booking_booking_template_path(object)}
5
+
6
+ = boot_page_title
7
+ = render 'new_form'
8
+
@@ -0,0 +1,11 @@
1
+ = contextual_links
2
+
3
+ = boot_page_title :new
4
+
5
+ = render 'form'
6
+
7
+ %h3= t_model(BookingTemplate)
8
+ = render 'booking_templates/list', :item_action => lambda{|object| new_booking_booking_template_path(object)}
9
+
10
+ %h3= t_model(Booking)
11
+ = render 'bookings/list', :item_action => lambda{|object| select_booking_booking_path(object, :booking => params[:booking])}
@@ -0,0 +1,7 @@
1
+ .contextual
2
+ = contextual_links_for
3
+ = icon_link_to :copy
4
+
5
+ = boot_page_title
6
+
7
+ = render 'show'
@@ -0,0 +1,4 @@
1
+ = contextual_links
2
+
3
+ = boot_page_title :new
4
+ = render 'simple_form'
@@ -0,0 +1,83 @@
1
+ # German locale
2
+ de:
3
+ activerecord:
4
+ models:
5
+ account: Konto
6
+ bank_account: Bankkonto
7
+ bank: Bank
8
+ account_type: Kontentyp
9
+ booking: Buchung
10
+
11
+ attributes:
12
+ account:
13
+ code: Nr.
14
+ title: Titel
15
+ saldo: Saldo
16
+ account_type: Kontentyp
17
+ bank_account:
18
+ number: Kontokorrent-Nr.
19
+ iban: IBAN
20
+ pc_id: VESR-Teilnehmer-Nr.
21
+ esr_id: VESR-Identifikations-Nr.
22
+ bank:
23
+ clearing: Clearing-Nr.
24
+ swift: SWIFT-Nr.
25
+ account_type:
26
+ name: Name
27
+ title: Titel
28
+ booking:
29
+ code: Belegnr.
30
+ value_date: Valutadatum
31
+ title: Titel
32
+ amount: Betrag
33
+ comments: Bemerkungen
34
+ credit_account: Soll
35
+ debit_account: Haben
36
+ reference: Referenz
37
+ reference_type: Referenz Typ
38
+ reference_id: Referenz ID
39
+ text: Text
40
+ date: Datum
41
+ balance: Saldo
42
+ edit: Editieren
43
+ destroy: Löschen
44
+ valuta: Valuta
45
+ value: Betrag
46
+
47
+ form:
48
+ bank:
49
+ money_transfer: Bankverbindung
50
+
51
+ # Title customizations
52
+ accounts:
53
+ index:
54
+ title: Kontenplan
55
+ edit_bookings:
56
+ title: Buchungen
57
+ info:
58
+ title: Kontodaten
59
+ journal:
60
+ title: Auszug
61
+ attachments:
62
+ list:
63
+ title: Dokumente
64
+ bank_accounts:
65
+ index:
66
+ title: Bankkonti
67
+ banks:
68
+ index:
69
+ title: Banken
70
+ account_types:
71
+ index:
72
+ title: Kontentypen
73
+ bookings:
74
+ index:
75
+ title: Buchungsjournal
76
+ copy:
77
+ title: Buchung kopieren
78
+
79
+ crud:
80
+ action:
81
+ copy: Kopieren
82
+ only_credit_bookings: "Nur Soll"
83
+ only_debit_bookings: "Nur Haben"
@@ -0,0 +1,65 @@
1
+ # English locale
2
+ en:
3
+ activerecord:
4
+ models:
5
+ account: Account
6
+ bank_account: Bank account
7
+ bank: Bank
8
+ account_type: Account type
9
+ booking: Booking
10
+
11
+ attributes:
12
+ account:
13
+ code: No.
14
+ title: Title
15
+ saldo: Saldo
16
+ account_type: Acocunt type
17
+ bank_account:
18
+ number: Account no.
19
+ iban: IBAN
20
+ pc_id: VESR no.
21
+ esr_id: VESR identifier
22
+ bank:
23
+ clearing: Clearing no.
24
+ swift: SWIFT no.
25
+ account_type:
26
+ name: Name
27
+ title: Title
28
+ booking:
29
+ code: Booking no.
30
+ value_date: Value date
31
+ title: Title
32
+ amount: Amount
33
+ comments: Remarks
34
+ credit_account: Credit
35
+ debit_account: Debit
36
+ reference: Reference
37
+ reference_type: Reference type
38
+ reference_id: Reference ID
39
+ text: Text
40
+ date: Date
41
+ balance: Saldo
42
+ edit: Edit
43
+ destroy: Delete
44
+ valuta: Valuta
45
+ value: Amount
46
+
47
+ # Title customizations
48
+ account:
49
+ index:
50
+ title: Accounts
51
+ bank_account:
52
+ index:
53
+ title: Bank Accounts
54
+ bank:
55
+ index:
56
+ title: Banks
57
+ account_type:
58
+ index:
59
+ title: Account Types
60
+ booking:
61
+ index:
62
+ title: Booking Journal
63
+ crud:
64
+ action:
65
+ copy: Kopieren
data/config/routes.rb ADDED
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+
3
+ # Routes
4
+ Rails.application.routes.draw do
5
+ # Bookings
6
+ resources :bookings do
7
+ collection do
8
+ post :select
9
+ get :simple_edit
10
+ end
11
+ member do
12
+ get :select_booking
13
+ get :copy
14
+ end
15
+ end
16
+
17
+ resources :accounts do
18
+ member do
19
+ get :csv_bookings
20
+ get :edit_bookings
21
+ post :update_bookings
22
+ end
23
+ resources :bookings
24
+ resources :attachments
25
+ end
26
+
27
+ resources :banks do
28
+ resources :phone_numbers
29
+ member do
30
+ get :new_phone_number
31
+ end
32
+ collection do
33
+ get :new_phone_number
34
+ end
35
+ end
36
+
37
+ resources :bank_accounts do
38
+ member do
39
+ get :csv_bookings
40
+ end
41
+ resources :bookings
42
+ resources :attachments
43
+ end
44
+ end
@@ -0,0 +1 @@
1
+ require 'has_accounts_engine/railtie' if defined?(::Rails::Railtie)
@@ -0,0 +1,8 @@
1
+ require 'has_accounts_engine'
2
+ require 'rails'
3
+
4
+ module HasAccountsEngine
5
+ class Railtie < Rails::Engine
6
+ engine_name "has_accounts_engine"
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module HasAccountsEngine
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: has_accounts_engine
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Simon Hürlimann (CyT)
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: has_accounts
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: has_vcards
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: i18n_rails_helpers
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: validates_timeliness
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: inherited_resources
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: HasAccountsEngine is a full featured Rails 3 gem accompanying has_accounts
111
+ with controllers, views...
112
+ email:
113
+ - simon.huerlimann@cyt.ch
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files:
117
+ - MIT-LICENSE
118
+ - README.md
119
+ files:
120
+ - app/controllers/accounts_controller.rb
121
+ - app/controllers/bank_accounts_controller.rb
122
+ - app/controllers/banks_controller.rb
123
+ - app/controllers/bookings_controller.rb
124
+ - app/helpers/account_helper.rb
125
+ - app/views/accounts/_account.html.haml
126
+ - app/views/accounts/_booking_item.html.haml
127
+ - app/views/accounts/_booking_list_footer.html.haml
128
+ - app/views/accounts/_booking_list_header.html.haml
129
+ - app/views/accounts/_booking_list_paginate.html.haml
130
+ - app/views/accounts/_booking_list_saldo.html.haml
131
+ - app/views/accounts/_booking_list_turnover.html.haml
132
+ - app/views/accounts/_carry_booking.html.haml
133
+ - app/views/accounts/_edit_booking.html.haml
134
+ - app/views/accounts/_edit_bookings.html.haml
135
+ - app/views/accounts/_form.html.haml
136
+ - app/views/accounts/_list_footer.html.haml
137
+ - app/views/accounts/_list_header.html.haml
138
+ - app/views/accounts/_show.html.haml
139
+ - app/views/accounts/_show_bookings.html.haml
140
+ - app/views/accounts/edit_bookings.html.haml
141
+ - app/views/accounts/edit_bookings.js.erb
142
+ - app/views/accounts/index.html.haml
143
+ - app/views/accounts/show.html.haml
144
+ - app/views/bank_accounts/_bank_account.html.haml
145
+ - app/views/bank_accounts/_form.html.haml
146
+ - app/views/banks/_bank.html.haml
147
+ - app/views/banks/_form.html.haml
148
+ - app/views/bookings/_booking.html.haml
149
+ - app/views/bookings/_form.html.haml
150
+ - app/views/bookings/_list.html.haml
151
+ - app/views/bookings/_new_form.html.haml
152
+ - app/views/bookings/_sidebar.html.haml
153
+ - app/views/bookings/_simple_form.html.haml
154
+ - app/views/bookings/new.html.haml
155
+ - app/views/bookings/select.html.haml
156
+ - app/views/bookings/show.html.haml
157
+ - app/views/bookings/simple_edit.html.haml
158
+ - config/locales/de.yml
159
+ - config/locales/en.yml
160
+ - config/routes.rb
161
+ - lib/has_accounts_engine.rb
162
+ - lib/has_accounts_engine/railtie.rb
163
+ - lib/has_accounts_engine/version.rb
164
+ - MIT-LICENSE
165
+ - README.md
166
+ homepage: https://github.com/huerlisi/has_accounts_engine
167
+ licenses:
168
+ - MIT
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 1.8.23
188
+ signing_key:
189
+ specification_version: 3
190
+ summary: HasAccountsEngine provides controllers, views for has_accounts.
191
+ test_files: []
192
+ has_rdoc: